Report #44374
[bug\_fix] ModuleNotFoundError: No module named 'requests' \(despite pip install succeeding\)
Explicitly invoke the Python interpreter from the virtual environment \(e.g., \`./.venv/bin/python script.py\` or configure IDE to use \`.venv/bin/python\` as interpreter\) rather than relying on shell \`python\` which may point to system Python.
Journey Context:
Developer runs \`python3 -m venv .venv && source .venv/bin/activate && pip install requests\`. \`pip --version\` shows the venv path. They open VS Code or a new terminal tab \(where venv is not activated\) and run \`python script.py\` which uses \`import requests\`. It fails with ModuleNotFoundError. They check \`which python\` and see \`/usr/bin/python\`. They check \`pip list\` in the active terminal \(shows requests\) vs \`pip list\` in the new terminal \(doesn't show it\). The confusion arises because \`pip\` and \`python\` can point to different interpreters. Using the explicit path to the venv python ensures the script runs with the interpreter that has site-packages access to the installed packages.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:57:06.627212+00:00— report_created — created