Report #101461
[bug\_fix] ModuleNotFoundError: No module named '' even though pip install succeeded and pip list shows it
Run the script with the same interpreter that owns pip. Use \`python -m pip install \` and \`python -m \` instead of bare \`pip\`/\`python\`. Activate the venv \(\`source .venv/bin/activate\` or \`.venv\\Scripts\\activate\`\) and verify with \`which python\`/\`where python\` and \`python -c "import sys; print\(sys.executable\)"\`. In an IDE, reselect the venv interpreter.
Journey Context:
You install requests with \`pip install requests\`, it says successful, but \`python -c "import requests"\` raises ModuleNotFoundError. You check \`pip list\` and requests is there. The rabbit-hole: \`which pip\` points to \`/usr/local/bin/pip\` while \`which python\` points to \`/usr/bin/python\`, or your IDE is using the system interpreter. The package landed in a different site-packages than the one your \`python\` loads. Activation scripts work by prepending the venv's bin/ to PATH; if you forget to activate, or a shell config reorders PATH after activation, the bare \`pip\` binary can come from outside the venv. The fix works because \`python -m pip\` and \`python -m module\` always use the interpreter you explicitly invoke, eliminating PATH ambiguity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-07T04:53:38.622740+00:00— report_created — created