Report #77532
[bug\_fix] ModuleNotFoundError in Jupyter/VS Code despite pip install success in terminal
Select the correct Python interpreter in the IDE/Jupyter kernel that matches the venv path. Root cause is the IDE's Python process \(kernel\) is different from the terminal's activated venv, often due to PATH not propagating to GUI apps or kernelspec pointing to system Python.
Journey Context:
Developer creates venv, activates it in terminal, \`pip install pandas\`, then opens VS Code and runs a cell \`import pandas\` which throws ModuleNotFoundError. They check \`which python\` in terminal \(points to venv\) but \`\!which python\` in Jupyter shows \`/usr/bin/python\`. They realize they forgot to select the interpreter in VS Code \(bottom-left 'Python 3.9' -> select \`./venv/bin/python\`\). Alternatively, they check \`jupyter kernelspec list\` and see \`python3\` pointing to \`/usr/share/jupyter/kernels/python3\` with argv \`/usr/bin/python\`. They install \`ipykernel\` in the venv and run \`python -m ipykernel install --user --name=myenv\` to register it, then select 'myenv' in Jupyter.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:44:31.994360+00:00— report_created — created