Skip to content

Venv not being added to PATH #754

@robertHowlett

Description

@robertHowlett

Type: Bug

Behaviour

When this extension is enabled, when I start a new terminal subfolder/.venv/Scripts is not on the path

Steps to reproduce:

  1. Using extensions Python Debugger 2025.10.0, Python 2025.10.0, VSCode 1.102.1, Windows_NT x64 10.0.26100, with vscode settings python.terminal.activateEnvInCurrentTerminal and python.terminal.activateEnvironment enabled
  2. create a Python 3.13.2 venv with uv inside subfolder/.venv, such that a python executable is at subfolder/.venv/Scripts/python
  3. Using Python: select interpreter select subfolder/.venv/Scripts/python
  4. Start a new terminal inside VSCode (any will do)
  5. Run which python

Expected behaviour: it returns <project_path>/subfolder/.venv/Scripts/python
Actual behaviour: it returns the system Python (in my case /c/Program Files/Python312/python)

The problem is resolved by disabling Python Debugger and restarting extensions + the terminal. I have reproduced on my colleagues' machines, which have very similar setups. Scanning $PATH shows that <project_path>/subfolder/.venv/Scripts is not on the path.

Diagnostic data

launch.json configuration

No such file exists

Output for Python in the Output panel (When Python Debugger is enabled)

2025-07-17 11:03:27.553 [info] Experiment 'pythonTestAdapter' is inactive
2025-07-17 11:03:27.553 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-07-17 11:03:27.553 [info] Native locator: Refresh started
2025-07-17 11:03:27.559 [info] Poetry environment manager found at: C:\Users\RobertHowlett\AppData\Roaming\Python\Python312\Scripts\poetry.exe
2025-07-17 11:03:27.626 [info] Native locator: Refresh finished in 122 ms
2025-07-17 11:03:27.628 [info] Python interpreter path: .\laughingowl\.venv\Scripts\python.exe
2025-07-17 11:03:27.672 [info] > pyenv which python
2025-07-17 11:03:27.672 [info] cwd: .
2025-07-17 11:03:28.735 [info] > . ./laughingowl/.venv/Scripts/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2025.10.0-win32-x64/python_files/printEnvVariables.py
2025-07-17 11:03:28.736 [info] shell: bash
2025-07-17 11:03:28.949 [info] > C:\Program Files\Python312\python.exe ~/.vscode/extensions/ms-python.python-2025.10.0-win32-x64/python_files/printEnvVariables.py
2025-07-17 11:03:28.949 [info] shell: bash
2025-07-17 11:03:29.017 [info] Setting environment variable EXEPATH in collection to C:\Users\RobertHowlett\AppData\Local\Programs\Git\bin {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-17 11:03:29.017 [info] Setting environment variable HOME in collection to C:\Users\RobertHowlett {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-17 11:03:29.017 [info] Setting environment variable MSYSTEM in collection to MINGW64 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-17 11:03:29.017 [info] Prepending environment variable PATH in collection to c:\Users\RobertHowlett\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\bash;C:\Projects\oaas-elephantbird\laughingowl\.venv\Scripts;C:\Users\RobertHowlett\AppData\Local\Programs\Git\mingw64\bin;C:\Users\RobertHowlett\AppData\Local\Programs\Git\usr\bin;C:\Users\RobertHowlett\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\PuTTY;C:\Users\RobertHowlett\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\Python312;C:\Program Files\Python312\Scripts;C:\Users\RobertHowlett\AppData\Local\Microsoft\WindowsApps;C:\Users\RobertHowlett\AppData\Roaming\Python\Python312\Scripts;C:\Users\RobertHowlett\AppData\Local\Microsoft\WinGet\Packages\jqlang.jq_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\Users\RobertHowlett\AppData\Local\Programs\Git\cmd; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-17 11:03:29.017 [info] Setting environment variable PLINK_PROTOCOL in collection to ssh {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-17 11:03:29.017 [info] Prepending environment variable PS1 in collection with (laughingowl)  {"applyAtShellIntegration":true,"applyAtProcessCreation":false}
2025-07-17 11:03:29.017 [info] Setting environment variable PYTHONIOENCODING in collection to utf-8 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-17 11:03:29.017 [info] Setting environment variable PYTHONUNBUFFERED in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-17 11:03:29.017 [info] Setting environment variable TERM in collection to xterm-256color {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-17 11:03:29.017 [info] Setting environment variable VIRTUAL_ENV in collection to C:/Projects/oaas-elephantbird/laughingowl/.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-17 11:03:29.018 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to laughingowl {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-17 11:03:29.018 [info] Send text to terminal: "C:/Program Files/Python312/python.exe" c:\Users\RobertHowlett\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\printEnvVariablesToFile.py c:\Users\RobertHowlett\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\bash\envVars.txt
2025-07-17 11:03:30.469 [info] Starting Pylance language server.
2025-07-17 11:03:59.027 [error] Failed to initialize deactivate script C:\Users\RobertHowlett\AppData\Local\Programs\Git\bin\bash.exe [Error: "c:\Users\RobertHowlett\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\bash\envVars.txt" file not created
	at Timeout.<anonymous> (c:\Users\RobertHowlett\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\out\client\extension.js:2:336746)
	at listOnTimeout (node:internal/timers:588:17)
	at process.processTimers (node:internal/timers:523:7)]

Output for Python Debugger in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python Debugger)

This is empty

System information

Extension version: 2025.10.0
VS Code version: Code 1.102.1 (7adae6a56e34cb64d08899664b814cf620465925, 2025-07-15T16:41:17.147Z)
OS version: Windows_NT x64 10.0.26100
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.2
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): VirtualEnvironment
System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-1270P (16 x 2496)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.44GB (2.11GB free)
Process Argv --crash-reporter-id b957ed93-a726-4367-8299-3bf862daa868
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
binariesv615:30325510
962ge761:31349326
2e7ec940:31000449
nativeloc1:31344060
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
hdaa2157:31222309
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
pythonpulldiag:31343502
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
9d2cg352:31346308
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31335815
nes-diff-11:31337487
992g2967-color:31348502
66g5g415:31348965
nes-set-on:31349227
6abeh943:31336334
yijiwantestdri0626-c:31336931
64bie973:31349831
4gdec884:31348710
7g84e740:31349836

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-neededNeeds assignment to the proper sub-team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions