Report #37689
[bug\_fix] ModuleNotFoundError after pip install --user \(user-site isolation\)
Install the package inside the active virtual environment using \`pip install \` \(without --user\) instead of \`pip install --user \`. Alternatively, recreate the venv with \`python3 -m venv venv --system-site-packages\` to allow access to user-site packages \(not recommended for isolation\). The root cause is that PEP 405 virtual environments isolate from system site-packages and user site-packages by default; \`pip install --user\` installs to a platform-specific user directory \(e.g., \`~/.local/lib/python3.x/site-packages\`\) which is NOT on \`sys.path\` inside a standard venv.
Journey Context:
Developer is new to virtual environments. They have been using \`pip install --user\` to install packages like \`requests\` globally without sudo. They start a new project, create a venv with \`python3 -m venv myenv\`, activate it, and write a script that imports requests. They get ModuleNotFoundError. Confused, they run \`pip list --user\` outside the venv and see requests listed. Inside the venv, \`pip list\` does not show it. They try \`pip install --user requests\` inside the venv, which succeeds but the import still fails. After reading about venv isolation, they realize user-site is excluded and that they must install directly into the venv without --user.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T17:44:32.183291+00:00— report_created — created