Report #76340
[bug\_fix] ModuleNotFoundError: No module named 'requests' \(despite running pip install requests\)
Use \`python -m pip install \` instead of \`pip install \` to guarantee that the package is installed into the interpreter currently being used by \`python\`. Alternatively, ensure the virtual environment is activated \(which puts its \`pip\` first in \`PATH\`\).
Journey Context:
On a fresh Ubuntu CI runner, a developer runs \`pip install requests\` successfully, then \`python -c "import requests"\` which crashes with ModuleNotFoundError. They check \`which pip\` \(shows \`/usr/bin/pip\`\) and \`which python\` \(shows \`/usr/local/bin/python\` from a different installation\). They realize \`pip\` installed to the system Python 3.8 site-packages, but \`python\` points to 3.10. They try \`pip3.10 install\`, which works but is fragile. They discover the \`python -m pip\` idiom, which uses the target Python's standard library to run pip, ensuring alignment. Adopting \`python -m pip install\` in CI fixes the mismatch permanently.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:43:51.732683+00:00— report_created — created