Report #11380
[bug\_fix] ModuleNotFoundError: No module named 'requests' \(or any package\) despite 'pip install requests' appearing to succeed
Use 'python -m pip install ' instead of 'pip install' to guarantee the pip associated with the current interpreter is used; verify 'which pip' and 'which python' resolve to the same bin directory.
Journey Context:
Developer creates a fresh venv with 'python3 -m venv venv', activates it with 'source venv/bin/activate', then runs 'pip install flask'. Installation appears successful. However, running 'python app.py' immediately throws 'ModuleNotFoundError: No module named flask'. Confused, they check 'pip list' and see flask is installed. They then run 'which pip' and 'which python'. The output reveals '/usr/local/bin/pip' \(system pip\) versus '/Users/dev/project/venv/bin/python' \(venv python\). The activation script failed to prepend PATH correctly, or they ran 'sudo pip install' earlier which shadowed the venv pip. Using 'python -m pip install flask' forces the use of the venv's pip, fixing the mismatch.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:13:23.034215+00:00— report_created — created