Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual environment activation is broken on Gitbash #22908

Closed
ababak opened this issue Feb 13, 2024 · 9 comments
Closed

Virtual environment activation is broken on Gitbash #22908

ababak opened this issue Feb 13, 2024 · 9 comments
Assignees
Labels
experimenting Feature is part of an experiment triage-needed Needs assignment to the proper sub-team

Comments

@ababak
Copy link

ababak commented Feb 13, 2024

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

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 13, 2024
@ababak
Copy link
Author

ababak commented Feb 13, 2024

Also I see one more problem in the path additions section:

d;C:\tmp\.venv\Scripts

instead of

d:\tmp\.venv\Scripts

@ababak
Copy link
Author

ababak commented Feb 13, 2024

Another problem is the PWD section that shows an irrelevant directory path

@ababak
Copy link
Author

ababak commented Feb 13, 2024

(.venv) 
a.babak@ABABAK MINGW64 C:/Users/a.babak/AppData/Local/Programs/Microsoft VS Code
$ echo $PATH
c:\Users.babak\.vscodetensions\ms-python.python-2024.0.1\pythonFiles\deactivatash;d;C: mp\.venv\Scripts;C:\Program Files\Git\mingw6in;C:\Program Files\Git\usin;C:\Users.babain;C:\Python39\Scripts;C:\Python39;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell
1.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:\Presourcein;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
(.venv) 
a.babak@ABABAK MINGW64 C:/Users/a.babak/AppData/Local/Programs/Microsoft VS Code
$ pwd
/d/tmp
(.venv) 
a.babak@ABABAK MINGW64 C:/Users/a.babak/AppData/Local/Programs/Microsoft VS Code
$ echo $PWD
C:/Users/a.babak/AppData/Local/Programs/Microsoft VS Code
(.venv) 

@karrtikr
Copy link

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 profile command to switch.

@karrtikr karrtikr added the experimenting Feature is part of an experiment label Feb 13, 2024
@karrtikr karrtikr self-assigned this Feb 13, 2024
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Feb 13, 2024
@karrtikr karrtikr changed the title Virtual environment activation is broken Virtual environment activation is broken on Gitbash Feb 13, 2024
@ababak
Copy link
Author

ababak commented Feb 13, 2024

It used to work until last week :(

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Feb 13, 2024
@ababak
Copy link
Author

ababak commented Feb 13, 2024

Unfortunately, other shells suffer from similar issues. The VSCODE_ENV_PREPEND variable already contains incorrect data.
This is cmd:

VSCODE_ENV_PREPEND=PATH=c\x3a\Users\a.babak\.vscode\extensions\ms-python.python-2024.0.1\pythonFiles\deactivate\bash;d;C\x3a\tmp\.venv\Scripts;C\x3a\Program Files\Git\mingw64\bin;C\x3a\Program Files\Git\usr\bin;C\x3a\Users\a.babak\bin;C\x3a\Python39\Scripts;C\x3a\Python39;C\x3a\Windows\system32;C\x3a\Windows;C\x3a\Windows\System32\Wbem;C\x3a\Windows\System32\WindowsPowerShell\v1.0;C\x3a\Windows\System32\OpenSSH;C\x3a\Program Files\dotnet;C\x3a\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C\x3a\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C\x3a\Program Files\Docker\Docker\resources\bin;C\x3a\Program Files\Git\cmd;C\x3a\Program Files\Microsoft VS Code\bin;C\x3a\Users\a.babak\AppData\Local\Microsoft\WindowsApps;C\x3a\Users\a.babak\AppData\Local\Programs\Microsoft VS Code\bin;:PS1=(.venv)

Path is not modified

@karrtikr
Copy link

I see, can you open a new report for other shells using Python: Report Issue and I can take a look asap?
Please provide the debug logs which can help diagnose the issue:

  • Run Developer: Set log level command
  • Select Trace
  • Run Developer: Reload Window command
  • Provide the output:
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2024
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Feb 13, 2024
@karrtikr
Copy link

Also, try switching to the pre-release version:

image

@ababak
Copy link
Author

ababak commented 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?

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Feb 13, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
experimenting Feature is part of an experiment triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants