Diagnose Shebang vs Virtual Environment Import Errors When a CLI tool fails with ModuleNotFoundError despite the package being installed, check if the shebang in or points to system Python instead of the venv Python. Verify the actual Python interpreter being used by examining the shebang ( vs ). If mismatched, update the shebang to explicitly point to the venv's Python executable. Be aware that auto-update mechanisms may revert custom shebangs—check for post-install scripts that regenerate entry points. ---