I work in VS Code in Python and use conda environments. Previously, the environment, after selecting it as a python interpreter, was automatically activated in the terminal. Currently, auto-activation does not occur for locally created workspace environments. It is still activated when you run the python script, but there is no clear indication in the terminal that the environment is currently activated. Checked with the `python' command in the terminal - it indicates the python version of the base environment, not the user's local one. My configuration:

  • Windows 11 Pro 23H2
  • Motherboard: Gigabyte Aorus Elite AX Z590
  • CPU: i7 11700k
  • Visual Studio Code v.1.87.2
  • miniconda3 v.24.3.0
  • python 3.11.8 - 3.12
  • python extension for VS Code v.2024.2.1

What's checked:

  • conda in the path variable - yes
  • conda in the Windows terminal (ps, cmd) - yes
  • PS in execution policy - yes

What is done:

  • Clean reinstallation of Windows 11 and all its components
  • Clean reinstallation of miniconda3, made sure that all paths are registered in path, works from under any Windows terminal.
  • Clean reinstallation of VSCode without syncing user settings
  • Reinstalled all python extensions for VSCode
  • Prescribed conda init for all shells

Interesting notes:

  • If the local anonymous environment was created in 2023, then auto-activation works on Windows 11
  • If you work on Windows 10, then auto-activation works with any environment
  • Windows 11 auto-activates all named global environments
  • An attempt to create an environment in Windows 10 and transfer it to a project on Windows 11 failed
1

There are 1 best solutions below

5
James On

I use a very similar setup: Windows 11, VS Code, Conda environments. This does not appear as an issue for me. However, when I open the terminal, a pop up message appears in the bottom right corner:

enter image description here

The "Learn more" link points to a wiki page on the VSCode-Python github page: https://github.com/microsoft/vscode-python/wiki/Activate-Environments-in-Terminal-Using-Environment-Variables