Repository navigation
Deactivate Script in remote server is Permission denied #23195
Copy link
Copy link
Closed
Labels
info-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
Type: Bug
When creating a virtual environment with python3 -m venv env and then opening the terminal
((env) ) randark@developer:~/code/20240407-ssti$ Anomalous double-bracket-wrapped environment hints appear
At the same time, when trying to de-activate the virtual environment, an anomalous insufficient permissions message appears
((env) ) randark@developer:~/code/20240407-ssti$ deactivate
bash: /home/randark/.vscode-server/extensions/ms-python.python-2024.4.0/python_files/deactivate/bash/deactivate: Permission deniedExtension version: 2024.4.0
VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z)
OS version: Windows_NT x64 10.0.22631
Modes: Unsupported
Remote OS version: Linux x64 6.5.0-17-generic
System Info
| Item | Value |
|---|---|
| CPUs | 13th Gen Intel(R) Core(TM) i7-13620H (16 x 2918) |
| 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.69GB (34.22GB free) |
| Process Argv | --crash-reporter-id c9f4871d-20e2-430d-8db2-04870357e670 |
| Screen Reader | no |
| VM | 29% |
| Item | Value |
|---|---|
| Remote | SSH: Developer |
| OS | Linux x64 6.5.0-17-generic |
| CPUs | 13th Gen Intel(R) Core(TM) i7-13620H (4 x 2918) |
| Memory (System) | 7.71GB (5.26GB free) |
| VM | 29% |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
d34g3935:30971562
fegfb526:30981948
bg6jg535:30979843
ccp2r3:30993541
dsvsc020:30976470
pythonait:31006305
gee8j676:31009558
dsvsc021:30996838
g1icg217:30999571
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
info-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Activity
VitusAcabado commentedon Apr 8, 2024
Experiencing the same issue as well. This was after the new update.
Am running on WSL2 Ubuntu 20.04
ykursav commentedon Apr 8, 2024
For work around -> With root access you can give rights to deactivate file with chmod.
sudo chmod 777 .vscode-server/extensions/ms-python.python-2024.4.0/python_files/deactivate/bash/deactivatemschoettner commentedon Apr 8, 2024
Same problem here, which also persists when rolling back to the previous version of VSCode (1.87.2). Cannot use the workaround that was suggested as I don't have sudo rights on the remote server.
mschoettner commentedon Apr 8, 2024
Update: After also deleting .vscode-server on the remote to force a reinstall of VS Code Server, it now seems to work again with version 1.87.2. So it probably is the last update causing the issue.
Burhan-Q commentedon Apr 8, 2024
+1
Pop!_OS 22.04 LTS
VSCode 1.88.0 Commit: 5c3e652f63e798a5ac2f31ffd0d863669328dc4c
Found this comment recommending to downgrade the Python Extension from
2024.4.0to2024.2.1which after a VSCode refresh and restarting the terminal, resolved the issue for me.leongj commentedon Apr 8, 2024
This worked for me on VSCode Insiders v1.89.0-insider
anthonykim1 commentedon Apr 10, 2024
Hello everyone the double parenthesis is fixed and tracked via: #23193. I'll look more into deactivate with remote scenarios.
eitanturok commentedon Apr 10, 2024
I'm running into the same issue on my MAC. Here are the specific details of my VSCode setup:
Update: Following Yunus Kursav (@ykursav)'s answer, I ran a slightly modified command
and now everything works!
elenavolkova93 commentedon Apr 15, 2024
+1
funkindy commentedon Apr 17, 2024
On local venvs deactivate also doesnt work and gives
zsh: permission denied.Fix is the same:
sudo chmod +x ~/.vscode/extensions/ms-python.python-2024.4.1/python_files/deactivate/zsh/deactivateI am on mac M1pro with zsh.
matt-forallepsilon commentedon Apr 18, 2024
+1
juhlinm commentedon Apr 18, 2024
+1
tljstewart commentedon Apr 22, 2024
✅
chmod +x ~/.vscode/extensions/ms-python.python-2024.4.1/python_files/deactivate/zsh/deactivate❌
chmod 7771 remaining item
nicola-lunghi commentedon Apr 24, 2024
the issue is that the deactivate script is created with the wrong permission in the
~/.vscode/extensions/ms-python.python-2024.4.1/python_files/deactivate/bash/deactivate
estelabalboa commentedon Apr 29, 2024
+1
anthonykim1 commentedon Apr 30, 2024
Deactivation with the current terminal environment variable activation experiment has some limitation as previously mentioned in: #22037. We then have made effort to inserting deactivate script path from Python extension to user to work around this, but I can see the permission issue for remote scenarios.
This is bit tricky since we cannot really automatically run deactivation with user admin permission without admin password, which should be private and is not ideal for extension to attempt. I'll be looking around to see if there are alternative ways we can go about injecting deactivation path for remote scenarios.
For now see, lets see if following https://github.com/microsoft/vscode-python/wiki/Fixing-%22deactivate%22-command-for-Virtual-Environments and inserting the path to deactivate script yourself(user) in shell specific initialization script works.
taralx commentedon May 1, 2024
Why is this script even here? I have this in my .bashrc now:
bigalnz commentedon May 23, 2024
What if I am running VSCode on Windows and want to connect (SSH) to Linux - what is the command to fix in this case?
covracer commentedon Jun 14, 2024
https://github.com/microsoft/vscode-python/blob/main/python_files/deactivate/bash/deactivate does not currently have any executable bits set. It looks like it used to but #22921 removed them. I've proposed #23620 to restore them.
I've noticed that pyenv-virtualenv requires
source deactivaterather thandeactivatehttps://github.com/pyenv/pyenv-virtualenv/blob/37917069ecba16602decd3dd2c8b09121c673a41/shims/deactivate#L5If there's a reason to prefer it, I think it'd be acceptable for vscode-python to also require the
source deactivatesyntax. I think the sourcing approach would need additional changes like switching from$0to$BASH_SOURCEhttps://stackoverflow.com/a/35006505/3787516.Restore execute bits on deactivate scripts (#23620)
jamesylgan commentedon Jun 21, 2024
source deactivatedoesn't seem to work either - butv24.2.1does solve the issuekarthiknadig commentedon Jun 21, 2024
James Gan (@jamesylgan) Try the pre-release it should have the fix
Restore execute bits on deactivate scripts (#23620)
Restore execute bits on deactivate scripts (microsoft#23620)
anthonykim1 commentedon Jun 12, 2025
We are planning to deprecate terminal environment experiment in favor of shell activation coming from python environment extension.
Could people try out the Python environment extension(https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-python-envs) with
python-envs.terminal.autoActivationTypeset to shell startup?This is supposed to be the "better"/"proper" activation without showing the
source... activateon your terminal.