Report #15124
[bug\_fix] ModuleNotFoundError after successful pip install \(interpreter mismatch\)
Use \`python -m pip install \` instead of \`pip install \`, or explicitly activate the virtual environment before running pip. This ensures pip installs packages into the site-packages directory of the specific Python interpreter you intend to use, rather than a different one earlier in your PATH.
Journey Context:
You run \`pip install requests\` and see it succeed. You then run \`python script.py\` and get \`ModuleNotFoundError: No module named 'requests'\`. Confused, you run \`pip list\` and see requests is definitely installed. You check \`which pip\` and see \`/usr/local/bin/pip\` \(Homebrew Python 3.10\), but \`which python\` shows \`/usr/bin/python\` \(system Python 3.9\). The realization hits: pip installed to one Python's site-packages, but your shell's \`python\` command points to a different interpreter entirely. Using \`python -m pip\` forces the pip module to run within that specific python interpreter's environment, guaranteeing alignment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:16:33.288459+00:00— report_created — created