Skip to content

[Windows] extension overwrites PATH, preventing virtual environment usage #609

@mcrumiller

Description

@mcrumiller

Since the no-config debugging update, my local venv python instances are not accessible via the terminal unless I explicitly activate the environment. I open a new terminal, and it appears my environment is activated, but it's not:

Microsoft Windows [Version 10.0.22631.4751]
(c) Microsoft Corporation. All rights reserved.

(.venv) C:\Projects>

However, my virtual environment is not available:

(.venv) C:\Projects>where python
C:\Users\me\AppData\Local\Programs\Python\Python312\python.exe
C:\Users\me\AppData\Local\Programs\Python\Python313\python.exe

If I manually activate, I then see the local instance on the path:

(.venv) C:\Projects>.venv\Scripts\activate.bat
(.venv) C:\Projects>where python
C:\Projects\.venv\Scripts\python.exe
C:\Users\me\AppData\Local\Programs\Python\Python312\python.exe
C:\Users\me\AppData\Local\Programs\Python\Python313\python.exe

This is also visible with an ECHO %PATH% from the console.

When I run Terminal: Show Environment Contributions, I see the following:

# Terminal Environment Changes

## Extension: ms-python.python


## Extension: ms-python.debugpy

Enables use of [no-config debugging](https://github.com/microsoft/vscode-python-debugger/wiki/No%E2%80%90Config-Debugging), `debugpy <script.py>`, in the terminal.

Enables use of [no-config debugging](https://github.com/microsoft/vscode-python-debugger/wiki/No%E2%80%90Config-Debugging), `debugpy <script.py>`, in the terminal. (workspace)

- `PYDEVD_DISABLE_FILE_VALIDATION=1`
- `DEBUGPY_ADAPTER_ENDPOINTS=C:\Users\<me>\AppData\Local\Temp\noConfigDebugAdapterEndpoints-34367d754ac0c5bc02ac\debuggerAdapterEndpoint.txt`
- `PATH=${env:PATH};c:\Users\me\.vscode\extensions\ms-python.debugpy-2025.0.0-win32-x64\bundled\scripts\noConfigScripts`
- `BUNDLED_DEBUGPY_PATH=c:\Users\me\.vscode\extensions\ms-python.debugpy-2025.0.0-win32-x64\bundled\libs\debugpy`

The PATH command above is probably overwriting the path and removing the local environment path.

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