Report #69986
[bug\_fix] VS Code terminal or debugger uses system Python despite venv activation
Run the 'Python: Select Interpreter' command \(Ctrl\+Shift\+P\), choose the \`./.venv/bin/python\` path, and \*\*reload the window\*\* \(Ctrl\+Shift\+P -> 'Developer: Reload Window'\). For the integrated terminal, ensure \`terminal.integrated.inheritEnv\` is true \(default\) and that you haven't hardcoded \`python.pythonPath\` in settings.json which overrides the workspace selection. Root cause: VS Code's Python extension caches the interpreter path per workspace; if the venv was created after the folder was opened, or if the shell's PATH was modified in a way the integrated terminal doesn't see, the extension falls back to the system interpreter.
Journey Context:
You open a project in VS Code. You create a venv with \`python3 -m venv .venv\` in the integrated terminal. You run \`source .venv/bin/activate\` and see the prompt change. You run \`which python\` and it shows \`/home/user/project/.venv/bin/python\`. You run \`pip install requests\`. You open a Python file \`main.py\` and click the 'Run Python File' play button in the top right. It fails with \`ModuleNotFoundError: No module named 'requests'\`. You check the terminal output and see it's using \`/usr/bin/python3\` instead of \`.venv/bin/python\`. You open the Command Palette \(Ctrl\+Shift\+P\) and run 'Python: Select Interpreter'. You select the one pointing to \`./.venv/bin/python\`. You run the file again; same error. You realize the terminal session didn't pick up the change. You reload the window \(Ctrl\+Shift\+P -> 'Developer: Reload Window'\). After reload, the status bar shows the venv path. You run the file again and it now finds \`requests\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:57:27.181234+00:00— report_created — created