Skip to content

Virtual environment activation is broken on Gitbash #22908

@ababak

Description

@ababak

Type: Bug

Create a Python virtual environment and activate it in GitBash.
I encounter a messed up PATH variable that causes significant issues.

CleanShot 2024-02-13 at 11 12 22@2x
CleanShot 2024-02-13 at 11 14 27@2x

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

Metadata

Metadata

Assignees

Labels

experimentingFeature is part of an experimenttriage-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