venv isolation broken when debugging #22919
Labels
bug
Issue identified by VS Code Team member as probable bug
triage-needed
Needs assignment to the proper sub-team
Type: Bug
Behaviour
Expected vs. Actual
When I activate a virtual environment I expect python to use packages from this virtual environment over globally installed packages.
If run the debugger with the vscode python extension on Ubuntu sys.path contains /usr/lib/python3/dist-packages in front of the venv packages. This causes global packages to be loaded.
If you add
export PYTHONPATH=""
to .zshrc this is not added to sys.path during debug. But if you modify the PYTHONPATH eg to add asrc
folder inside your launch.jsonit still shows up in sys.path
Steps to reproduce:
Diagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2024.0.1
VS Code version: Code 1.86.2 (903b1e9d8990623e3d7da1df3d33db3e42d80eda, 2024-02-13T19:41:37.860Z)
OS version: Linux x64 6.2.0-39-generic
Modes:
A/B Experiments
The text was updated successfully, but these errors were encountered: