Repository navigation
Virtual environment activation is broken on Gitbash #22908
Copy link
Copy link
Closed as not planned
Labels
experimentingFeature is part of an experimentFeature is part of an experimenttriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
Type: Bug
Create a Python virtual environment and activate it in GitBash.
I encounter a messed up PATH variable that causes significant issues.
Path additions:
## Extension: ms-python.python
Activated environment for `.\.venv\Scripts\python.exe`
- `EXEPATH=C:\Program Files\Git\bin`
- `HOME=C:\Users\a.babak`
- `MSYS=disable_pcon`
- `MSYSTEM=MINGW64`
- `PATH=c:\Users\a.babak\.vscode\extensions\ms-python.python-2024.0.1\pythonFiles\deactivate\bash;d;C:\tmp\.venv\Scripts;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\a.babak\bin;C:\Python39\Scripts;C:\Python39;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 (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft VS Code\bin;C:\Users\a.babak\AppData\Local\Microsoft\WindowsApps;C:\Users\a.babak\AppData\Local\Programs\Microsoft VS Code\bin;${env:PATH}`
- `PLINK_PROTOCOL=ssh`
- `PS1=(.venv) ${env:PS1}`
- `PWD=C:/Users/a.babak/AppData/Local/Programs/Microsoft VS Code`
- `PYTHONIOENCODING=utf-8`
- `PYTHONUNBUFFERED=1`
- `TERM=xterm-256color`
- `VIRTUAL_ENV=d:\tmp\.venv`
Result in the terminal (note the unescaped backslashes):
declare -x PATH=$'c:\\Users\a.babak\\.vscode\Extensions\\ms-python.python-2024.0.1\\pythonFiles\\deactivate\bash;d;C:\tmp\\.venv\\Scripts;C:\\Program Files\\Git\\mingw64\bin;C:\\Program Files\\Git\\usr\bin;C:\\Users\a.babak\bin;C:\\Python39\\Scripts;C:\\Python39;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 (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\Program Files\\Docker\\Docker\resources\bin;C:\\Program Files\\Git/c/Users/a.babak/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/a.babak/bin:/c/Python39/Scripts:/c/Python39:/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 (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/Program Files/Docker/Docker/resources/bin:/cmd:/c/Program Files/Microsoft VS Code/bin:/c/Users/a.babak/AppData/Local/Microsoft/WindowsApps:/c/Users/a.babak/AppData/Local/Programs/Microsoft VS Code/bin:/usr/bin/vendor_perl:/usr/bin/core_perl'
Extension version: 2024.0.1
VS Code version: Code 1.86.1 (31c37ee8f63491495ac49e43b8544550fbae4533, 2024-02-07T09:08:20.941Z)
OS version: Windows_NT x64 10.0.22631
Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 x 3600) |
| 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 |
| Load (avg) | undefined |
| Memory (System) | 63.94GB (49.62GB free) |
| Process Argv | --crash-reporter-id 358dba80-56fc-470c-833a-f2ad595e317d |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
pydisww1:30959800
b1063948:30958189
e3gdj431:30958358
ccp2r3:30958157
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
experimentingFeature is part of an experimentFeature is part of an experimenttriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team


Activity
ababak commentedon Feb 13, 2024
Also I see one more problem in the path additions section:
instead of
ababak commentedon Feb 13, 2024
Another problem is the PWD section that shows an irrelevant directory path
ababak commentedon Feb 13, 2024
karrtikr commentedon Feb 13, 2024
Git bash isn't officially supported by the Python extension, please try using a different shell like Command prompt or Powershell. You can use
Select default profilecommand to switch.[-]Virtual environment activation is broken[/-][+]Virtual environment activation is broken on Gitbash[/+]ababak commentedon Feb 13, 2024
It used to work until last week :(
ababak commentedon Feb 13, 2024
Unfortunately, other shells suffer from similar issues. The
VSCODE_ENV_PREPENDvariable already contains incorrect data.This is cmd:
Path is not modified
karrtikr commentedon Feb 13, 2024
I see, can you open a new report for other shells using
Python: Report Issueand I can take a look asap?Please provide the debug logs which can help diagnose the issue:
Developer: Set log levelcommandTraceDeveloper: Reload WindowcommandOutput for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)karrtikr commentedon Feb 13, 2024
Also, try switching to the pre-release version:
ababak commentedon Feb 13, 2024
Switching to the pre-release version was the first thing I tested. Or do you need the logs from the pre-release?