Report #94283
[bug\_fix] ModuleNotFoundError immediately after \`pip install --user\` reports successful installation
Unset the \`PYTHONNOUSERSITE\` environment variable if it is set, or stop using \`--user\` installs and switch to a virtual environment \(\`python -m venv\`\). If the Python interpreter was compiled with \`ENABLE\_USER\_SITE=False\`, you must use a venv or recompile.
Journey Context:
Developer on a university HPC cluster loads Python 3.9. They lack write access to system site-packages. They run \`pip install --user numpy\`, which succeeds and installs to \`~/.local/lib/python3.9/site-packages\`. They run \`python -c "import numpy"\` and get ModuleNotFoundError. They check \`pip show numpy\` and see the user location. They check \`python -m site\` and see \`ENABLE\_USER\_SITE: False\`. They search and discover that the system administrator has set \`PYTHONNOUSERSITE=1\` globally to prevent users from shadowing system packages. The user site-packages directory is completely ignored by the interpreter. The developer realizes they must use a virtual environment to install packages locally.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:50:20.512857+00:00— report_created — created