-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Venv is not activated when a new zsh terminal is open #24982
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
Comments
+1 I have the same problem and I can add more information. I work in a Python devcontainer, so all my setup is isolated from the pysical machine and is versioned it git. I can provide a GitHub repo configured where the feature was working in the past and not anymore now. |
+1 here. Maybe this is helpful as well: I use conda and what happens for me is that it seems to activate the environment ("conda info" shows the active environment py39 correctly) but when I do "which python" it shows not the version inside the environment but as if it wasn't activated. When I do "conda deactivate && conda activate py39" it works as expected again. It used to work last Friday as expected and I think VSCode was then automatically updated and seems to behave in this way since then. |
+1 It can be confirmed that in Windows 11 WSL and macOS, the conda environment in zsh is always base and cannot automatically activate the selected environment. |
Can you share the logs from Output > Python? |
Output > Python:2025-04-14 12:51:46.753 [info] Experiment 'pythonRecommendTensorboardExt' is active |
@giulianopicco Try disabling the following experiment, by adding this setting to your User Settings then reload and see if it works better.
|
@karthiknadig Your solution worked perfectly—thanks for the quick and effective fix! 🙌 |
I have tried this settings, both adding it to the .vscode/settings.json and to the devcontainer.json file. |
It works for me, thanks.👍 |
This worked for me as well. I believe it looks a bit different when it activates in the terminal than before (it shows the command twice; I think it used to do that in the past as well though). But it works again the same way. |
To me it really doesn't work...
vscode ➜ /workspaces/ChatWithYourAudioFiles (feat/asyncingestion) $ cd
backend/
vscode ➜ /workspaces/ChatWithYourAudioFiles/backend (feat/asyncingestion) $
which python
/usr/local/python/current/bin/python
vscode ➜ /workspaces/ChatWithYourAudioFiles/backend (feat/asyncingestion) $
In my case, I have a .venv created in the "backend" folder.
I am working in a devcontainer.
…On Wed, Apr 16, 2025 at 12:17 PM Christian Reiter ***@***.***> wrote:
@giulianopicco <https://github.com/giulianopicco> Try disabling the
following experiment, by adding this setting to your *User Settings* then
reload and see if it works better.
"python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"]
This worked for me as well. I believe it looks a bit different when it
activates in the terminal than before (it shows the command twice; I think
it used to do that in the past as well though). But it works again the same
way.
—
Reply to this email directly, view it on GitHub
<#24982 (comment)>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEN72M6VVV47HNO3FNKQSV32ZYU3RBFKMF2HI4TJMJ2XIZLTSSBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDUOJ2WLJDOMFWWLLTXMF2GG2C7MFRXI2LWNF2HTAVFOZQWY5LFUVUXG43VMWSG4YLNMWVXI2DSMVQWIX3UPFYGLAVFOZQWY5LFVIYTCMZYGE3TINJSGOSG4YLNMWUWQYLTL5WGCYTFNSWHG5LCNJSWG5C7OR4XAZNMJFZXG5LFINXW23LFNZ2KM5DPOBUWG44TQKSHI6LQMWVHEZLQN5ZWS5DPOJ42K5TBNR2WLKJRGA3DINRSG43DLAVEOR4XAZNFNFZXG5LFUV3GC3DVMWVDEOJZGMZTGMZSGA3YFJDUPFYGLJLMMFRGK3FFOZQWY5LFVIYTCMZYGE3TINJSGOTXI4TJM5TWK4VGMNZGKYLUMU>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
--
*Damiano Curia*
Swiss mobile: +41 76 50 40 60 2
Italian mobile: +39 348/360.25.73
skype: curia.damiano
email: ***@***.***
www: http://curia.me
|
I had the same issue. The extension did not add |
That's too bad. |
For remote and dev container cases you need to put the setting in the remote machine global settings. When you bring up the settings UI you should be able to see 3 setting levels User, remote, and workspace. After adding it there, you need to reload. Can you share the logs after making the changes. An alternative is install the Python Environments extension. That is a preview extension, a work in progress, but it can help in this scenario: https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-python-envs |
I have tried to add the setting at User, Remote and Workspace level, I have closed the remote, reopened, restarted VS Code, rebuilt the container, but nothing... Then I have installed the extension you suggested. It doesn't find my .venv environment, that is in /workspaces/ProjectName/backend. I would prefer to have the .venv in my backend folder. |
@curia-damiano Can you try pinning the Python extension to 2025.2.* to see if that helps this issue? This is really strange that it started failing. Hopefully pinning the extension or the option below should help. For the Python Envs extension Can you right click on the "backend" folder and select "Add Python Project". That should pick up the /cc @eleanorjboyd Looks like we may need to revisit #24921 |
…icrosoft#24988) This reverts commit 6a60c92. fixes microsoft#24982
…icrosoft#24988) This reverts commit 6a60c92. fixes microsoft#24982
Type: Bug
The current selected python virtual environment is not being activated when a new zsh terminal is opened
VS Code version: Code 1.99.1 (7c6fdfb0b8f2f675eb0b47f3d95eeca78962565b, 2025-04-04T15:58:59.624Z)
OS version: Darwin arm64 24.4.0
Modes:
System Info
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
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Extensions (127)
(1 theme extensions excluded)
A/B Experiments
The text was updated successfully, but these errors were encountered: