Open sil-lnagel opened 8 months ago
I am having a similar issue with conda environments (https://github.com/microsoft/vscode-python/issues/22918). It seems like something is botched in the Python plugin.
This is particularly annoying as I cannot debug properly unless I install the packages in the base environment.
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
)``` XXX ```
User Settings
``` languageServer: "Pylance" terminal • activateEnvironment: false ```
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
``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 vscrpc:30673769 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 edj9j583:30958191 fegfb526:30961430 7j2b6412:30964151 ccp1r6:30958156 ```