Report #29448
[bug\_fix] ModuleNotFoundError: No module named 'pandas' \(or any package installed in a venv\)
Select the virtual environment's Python interpreter in the IDE \(VS Code status bar or PyCharm project settings\) and reload the terminal/IDE to refresh the PATH and VIRTUAL\_ENV variables so the correct site-packages directory is used.
Journey Context:
Developer creates a fresh venv with 'python3 -m venv .venv', activates it in the terminal with 'source .venv/bin/activate', and runs 'pip install pandas'. The install succeeds. Developer then opens VS Code, which auto-detects the system Python at '/usr/bin/python3' instead of the venv. The integrated terminal inherits VS Code's environment without activation, so 'which python' shows '/usr/bin/python3'. Running the script raises ModuleNotFoundError. Developer checks 'pip list' in the terminal and sees pandas missing, realizes the terminal is not in the venv. Clicking the Python version in the VS Code status bar and selecting './.venv/bin/python3' updates the interpreter, but the terminal session is stale. Developer runs 'Reload Window' from the command palette, reopening the terminal with the correct PATH prepended with '.venv/bin', and the import succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:49:02.251916+00:00— report_created — created