Report #97715
[bug\_fix] \`pip\` installs packages into the global site-packages while inside an activated venv
Run \`python -m pip\` instead of the bare \`pip\` command, or ensure the venv's \`bin/\` directory appears first in \`$PATH\` and that no \`pip\` wrapper is shadowing it. The root cause is that shell path resolution can invoke a different \`pip\` executable than the Python interpreter associated with the active venv, so packages are installed for the wrong interpreter.
Journey Context:
You activate a venv, run \`pip install requests\`, then \`python -c "import requests"\` fails with ModuleNotFoundError. You run \`which pip\` and it returns \`/usr/bin/pip\` instead of \`.venv/bin/pip\`. You reordered PATH but a shell alias or \`hash -r\` cache still points to the system pip. After switching to \`python -m pip install requests\`, the package installs into the venv's site-packages because you are invoking pip as a module on the exact interpreter you are running.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:34:49.394856+00:00— report_created — created