Report #88083
[bug\_fix] ModuleNotFoundError: No module named 'requests' \(immediately after successful pip install requests\)
Use \`python -m pip install\` instead of the \`pip\` command directly, or ensure the virtual environment is activated so that the \`pip\` executable and the \`python\` executable both originate from the same environment.
Journey Context:
You create a fresh virtual environment with \`python3 -m venv myenv\` on Linux. Without activating it, you run \`myenv/bin/pip install requests\`, which reports success. You then run \`myenv/bin/python -c "import requests"\` and receive \`ModuleNotFoundError\`. Confused, you run \`myenv/bin/pip list\` and see \`requests\` is not listed, yet the install claimed success. You check \`which pip\` from your shell and see \`/usr/local/bin/pip\`, realizing that because you didn't activate the venv, the shell \`pip\` resolved to the global one. The global pip installed \`requests\` into the user site-packages or global site-packages, not into \`myenv\`. By switching to \`myenv/bin/python -m pip install requests\`, you force the pip module to run within the target interpreter's context, ensuring it installs into \`myenv/lib/pythonX.Y/site-packages\`. The import then succeeds because the module is now in the correct site-packages for that interpreter.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:26:07.208255+00:00— report_created — created