Skip to content

The automatic activation mechanism has been damaged #664

Description

Before, my terminal in VSCode will keep conda env activated automatically without conda init, when I choose a python interpreter.
But now, it break my python env auto activation. When I use code runner to run a python script in a new terminal, the terminal don't activate in the desired python interpreter, but use the default base env of conda. I want to solve how can I keep workshop's terminal in desired python interpreter env when as soon as I open it without using any commands.

My core problem is the terminal don't keep in the workshop's python interpreter env, but when I open terminal, it run Anaconda/Scripts/activate to activate env, which report "CondaError: Run 'conda init' before 'conda activate'", but i don't want use conda init to pollute my terminal.

I'm not a professional developer, my description might be somewhat inappropriate. For more information please ask me.

Activity

  1. karthiknadig commented on Jul 29, 2025

    @karthiknadig
    Member

    @Super-wyc Can you share your settings? do you have python.condaPath set somewhere?

    Can you share the output from Output > Python Environments?

    Image
  2. supralune commented on Jul 29, 2025

    @supralune
    Author

    @Super-wyc Can you share your settings? do you have python.condaPath set somewhere?

    Can you share the output from Output > Python Environments?

    Image

    Karthik Nadig (@karthiknadig)
    "python.analysis.inlayHints.pytestParameters": true, "python.analysis.inlayHints.functionReturnTypes": true, "python.analysis.inlayHints.callArgumentNames": "all", "python.defaultInterpreterPath": "E:\\cs\\Anaconda\\envs\\dl\\python.exe", "python.terminal.activateEnvironment":true,
    There are my python extension settings.

    `
    2025-07-29 10:51:01.681 [info] Native locator: Refresh started
    2025-07-29 10:51:01.681 [info] > pyenv which python
    2025-07-29 10:51:01.681 [info] cwd: e:\Traffic courses\Grade3b\Traffic management and control\plot
    2025-07-29 10:51:01.686 [info] Conda environment manager found at: E:\cs\Anaconda\Scripts\conda.exe
    2025-07-29 10:51:01.686 [info] Using conda: E:\cs\Anaconda\Scripts\conda.exe
    2025-07-29 10:51:02.019 [info] > E:\cs\Anaconda\Scripts\conda.exe info --json
    2025-07-29 10:51:02.105 [info] Native locator: Refresh finished in 846 ms
    2025-07-29 10:51:03.719 [info] Python 解释器路径: E:\cs\Anaconda\envs\trans\python.exe
    2025-07-29 10:51:05.177 [info] 正在启动 Pylance 语言服务器。
    2025-07-29 10:51:05.480 [info] Send text to terminal: E:/cs/Anaconda/Scripts/activate
    2025-07-29 10:51:05.985 [info] Send text to terminal: conda activate trans

    `
    There are python extension output, and i can't find Output > Python Environments. Next is all outputs related python.

    Image

    I hope the terminal keep in the env without explicit commands before I open it as before. But now it change a explicit activation, i want to return the previous state, I have tried uninstall python env extension and degrade python extension but failed. I'm not quite sure whether this problem is caused by the python extension or the python env extension.

  3. karthiknadig commented on Jul 29, 2025

    @karthiknadig
    Member

    Run this command and it should restore things for you:

    Image
  4. supralune commented on Jul 29, 2025

    @supralune
    Author

    Run this command and it should restore things for you:

    Image

    Karthik Nadig (@karthiknadig) I tried it but nothing changed, I still can't find Output > Python Environments. Any ways to achieve env implicit activation without conda init or any other scripts, just like "Out of the box" ? Thanks for your patience.🥺

  5. eleanorjboyd commented on Jul 30, 2025

    @eleanorjboyd
    Member

    Hi! Can you confirm you have installed the python environments extension and add the following to your user settings python.useEnvironmentsExtension: true.

    Then you should be able to reload and see that output channel and re-attempt the activation.

  6. supralune commented on Jul 31, 2025

    @supralune
    Author

    Eleanor Boyd (@eleanorjboyd) After set python.useEnvironmentsExtension: true, the extension worked. There are the outputs.

    2025-07-31 09:42:32.058 [info] Extension for manager ms-python.python:conda is not active: Activating...
    2025-07-31 09:42:32.058 [info] Starting Python Locator c:\Users\wyc.vscode\extensions\ms-python.vscode-python-envs-1.2.0-win32-x64\python-env-tools\bin\pet.exe server
    2025-07-31 09:42:32.058 [info] Using conda from persistent state: E:\cs\Anaconda\Scripts\conda.EXE
    2025-07-31 09:42:32.058 [info] Refreshing conda environments
    2025-07-31 09:42:32.744 [info] Discovered manager: (Conda) E:\cs\Anaconda\Scripts\conda.exe
    2025-07-31 09:42:32.744 [info] Discovered env: E:\cs\Anaconda\python.exe
    2025-07-31 09:42:32.745 [info] Discovered env: E:\cs\Anaconda\envs\dl\python.exe
    2025-07-31 09:42:32.745 [info] Discovered env: E:\cs\Anaconda\envs\egd\python.exe
    2025-07-31 09:42:32.745 [info] Discovered env: E:\cs\Anaconda\envs\egtt\python.exe
    2025-07-31 09:42:32.745 [info] Discovered env: E:\cs\Anaconda\envs\llm\python.exe
    2025-07-31 09:42:32.746 [info] Discovered env: E:\cs\Anaconda\envs\mmcv\python.exe
    2025-07-31 09:42:32.746 [info] Discovered env: E:\cs\Anaconda\envs\trans\python.exe
    2025-07-31 09:42:32.746 [info] Discovered env: E:\cs\Anaconda\envs\visual\python.exe
    2025-07-31 09:42:32.746 [info] Discovered env: E:\Computer\python\python38\python.exe
    2025-07-31 09:42:32.746 [warning] Install path is empty HKCU\Software\Python\PythonCore\3.9
    2025-07-31 09:42:32.800 [info] Locator Conda took 73.5921ms
    2025-07-31 09:42:32.800 [info] Locator PipEnv took 231.1µs
    2025-07-31 09:42:32.801 [info] Locator Pixi took 124µs
    2025-07-31 09:42:32.802 [info] Locator Poetry took 2.8369ms
    2025-07-31 09:42:32.810 [info] Locator PyEnv took 944.3µs
    2025-07-31 09:42:32.810 [info] Locator Venv took 194.1µs
    2025-07-31 09:42:32.810 [info] Locator VirtualEnv took 58.5µs
    2025-07-31 09:42:32.810 [info] Locator VirtualEnvWrapper took 32.2µs
    2025-07-31 09:42:32.810 [info] Locator WindowsRegistry took 22.5948ms
    2025-07-31 09:42:32.810 [info] Locator WindowsStore took 807.4µs
    2025-07-31 09:42:32.810 [info] Locator GlobalVirtualEnvs took 985.7µs
    2025-07-31 09:42:32.810 [info] Locator Locators took 74.2684ms
    2025-07-31 09:42:32.811 [info] Locator Path took 18.2501ms
    2025-07-31 09:42:32.811 [info] Locator Workspaces took 2.7978ms
    2025-07-31 09:42:32.811 [info] Using conda from cache: E:\cs\Anaconda\Scripts\conda.EXE
    2025-07-31 09:42:32.819 [info] Found base environment: E:\cs\Anaconda
    2025-07-31 09:42:32.819 [info] Found named environment: E:\cs\Anaconda\envs\dl
    2025-07-31 09:42:32.819 [info] Found named environment: E:\cs\Anaconda\envs\egd
    2025-07-31 09:42:32.819 [info] Found named environment: E:\cs\Anaconda\envs\egtt
    2025-07-31 09:42:32.819 [info] Found named environment: E:\cs\Anaconda\envs\llm
    2025-07-31 09:42:32.820 [info] Found named environment: E:\cs\Anaconda\envs\mmcv
    2025-07-31 09:42:32.820 [info] Found named environment: E:\cs\Anaconda\envs\trans
    2025-07-31 09:42:32.820 [info] Found named environment: E:\cs\Anaconda\envs\visual
    2025-07-31 09:42:32.822 [info] Python API: Changed environment from undefined to dl (3.11.9) for: e:\cs\test
    2025-07-31 09:42:32.822 [info] Internal: Changed environment from undefined to dl (3.11.9) for: e:\cs\test
    2025-07-31 09:42:32.823 [info] Telemetry: {"event":"RefreshPerformance","data":{"refreshPerformance":{"total":75,"breakdown":{"GlobalVirtualEnvs":0,"Locators":74,"Path":18,"Workspaces":2},"locators":{"Conda":73,"PipEnv":0,"Pixi":0,"Poetry":2,"PyEnv":0,"Venv":0,"VirtualEnv":0,"VirtualEnvWrapper":0,"WindowsRegistry":22,"WindowsStore":0}}}}
    2025-07-31 09:42:32.825 [info] Locator GlobalVirtualEnvs took 500ns
    2025-07-31 09:42:32.825 [info] Locator Locators took 400ns
    2025-07-31 09:42:32.825 [info] Locator Path took 300ns
    2025-07-31 09:42:32.825 [info] Locator Workspaces took 773.1µs
    2025-07-31 09:42:32.827 [info] Telemetry: {"event":"RefreshPerformance","data":{"refreshPerformance":{"total":1,"breakdown":{"GlobalVirtualEnvs":0,"Locators":0,"Path":0,"Workspaces":0},"locators":{}}}}
    2025-07-31 09:42:35.261 [error] Shell execution timed out: (& E:\cs\Anaconda\shell\condabin\conda-hook.ps1) ; (conda activate dl)
    2025-07-31 09:42:35.261 [info] Terminal is activated: e:\cs\Anaconda\envs\dl
    2025-07-31 09:42:39.976 [info] Pyenv not found, turning off pyenv features.
    2025-07-31 09:42:45.068 [info] Extension for manager ms-python.python:conda is now active.
    2025-07-31 09:42:45.086 [info] Refreshing Conda Environments
    2025-07-31 09:42:45.086 [info] Refreshing conda environments
    2025-07-31 09:42:48.380 [info] Discovered manager: (Conda) E:\cs\Anaconda\Scripts\conda.exe
    2025-07-31 09:42:48.380 [info] Discovered env: E:\cs\Anaconda\python.exe
    2025-07-31 09:42:48.381 [info] Discovered env: E:\cs\Anaconda\envs\dl\python.exe
    2025-07-31 09:42:48.381 [info] Discovered env: E:\cs\Anaconda\envs\egd\python.exe
    2025-07-31 09:42:48.381 [info] Discovered env: E:\cs\Anaconda\envs\egtt\python.exe
    2025-07-31 09:42:48.381 [info] Discovered env: E:\cs\Anaconda\envs\llm\python.exe
    2025-07-31 09:42:48.381 [info] Discovered env: E:\cs\Anaconda\envs\mmcv\python.exe
    2025-07-31 09:42:48.381 [info] Discovered env: E:\cs\Anaconda\envs\trans\python.exe
    2025-07-31 09:42:48.381 [info] Discovered env: E:\cs\Anaconda\envs\visual\python.exe
    2025-07-31 09:42:48.381 [info] Discovered env: E:\Computer\python\python38\python.exe
    2025-07-31 09:42:48.381 [warning] Install path is empty HKCU\Software\Python\PythonCore\3.9
    2025-07-31 09:42:48.382 [info] Locator Conda took 63.1115ms
    2025-07-31 09:42:48.382 [info] Locator PipEnv took 337.4µs
    2025-07-31 09:42:48.382 [info] Locator Pixi took 100.1µs
    2025-07-31 09:42:48.382 [info] Locator Poetry took 2.208ms
    2025-07-31 09:42:48.382 [info] Locator PyEnv took 1.4782ms
    2025-07-31 09:42:48.382 [info] Locator Venv took 67.6µs
    2025-07-31 09:42:48.382 [info] Locator VirtualEnv took 160.5µs
    2025-07-31 09:42:48.382 [info] Locator VirtualEnvWrapper took 217.7µs
    2025-07-31 09:42:48.382 [info] Locator WindowsRegistry took 21.0048ms
    2025-07-31 09:42:48.382 [info] Locator WindowsStore took 367.2µs
    2025-07-31 09:42:48.382 [info] Locator GlobalVirtualEnvs took 555µs
    2025-07-31 09:42:48.382 [info] Locator Locators took 66.5932ms
    2025-07-31 09:42:48.382 [info] Locator Path took 14.8107ms
    2025-07-31 09:42:48.382 [info] Locator Workspaces took 1.8807ms
    2025-07-31 09:42:48.389 [info] Telemetry: {"event":"RefreshPerformance","data":{"refreshPerformance":{"total":66,"breakdown":{"GlobalVirtualEnvs":0,"Locators":66,"Path":14,"Workspaces":1},"locators":{"Conda":63,"PipEnv":0,"Pixi":0,"Poetry":2,"PyEnv":1,"Venv":0,"VirtualEnv":0,"VirtualEnvWrapper":0,"WindowsRegistry":21,"WindowsStore":0}}}}
    2025-07-31 09:42:48.391 [info] Locator GlobalVirtualEnvs took 400ns
    2025-07-31 09:42:48.391 [info] Locator Locators took 400ns
    2025-07-31 09:42:48.391 [info] Locator Path took 100ns
    2025-07-31 09:42:48.391 [info] Locator Workspaces took 672.3µs
    2025-07-31 09:42:48.391 [info] Telemetry: {"event":"RefreshPerformance","data":{"refreshPerformance":{"total":1,"breakdown":{"GlobalVirtualEnvs":0,"Locators":0,"Path":0,"Workspaces":0},"locators":{}}}}
    2025-07-31 09:42:48.404 [info] Discovered manager: (Conda) E:\cs\Anaconda\Scripts\conda.exe
    2025-07-31 09:42:48.405 [info] Discovered env: E:\cs\Anaconda\python.exe
    2025-07-31 09:42:48.405 [info] Discovered env: E:\cs\Anaconda\envs\dl\python.exe
    2025-07-31 09:42:48.405 [info] Discovered env: E:\cs\Anaconda\envs\egd\python.exe
    2025-07-31 09:42:48.406 [info] Discovered env: E:\cs\Anaconda\envs\egtt\python.exe
    2025-07-31 09:42:48.407 [info] Discovered env: E:\cs\Anaconda\envs\llm\python.exe
    2025-07-31 09:42:48.408 [info] Discovered env: E:\cs\Anaconda\envs\mmcv\python.exe
    2025-07-31 09:42:48.410 [info] Discovered env: E:\cs\Anaconda\envs\trans\python.exe
    2025-07-31 09:42:48.412 [info] Discovered env: E:\cs\Anaconda\envs\visual\python.exe
    2025-07-31 09:42:48.412 [info] Discovered env: E:\Computer\python\python38\python.exe
    2025-07-31 09:42:48.412 [warning] Install path is empty HKCU\Software\Python\PythonCore\3.9
    2025-07-31 09:42:48.460 [info] Locator Conda took 66.7657ms
    2025-07-31 09:42:48.460 [info] Locator PipEnv took 226.1µs
    2025-07-31 09:42:48.460 [info] Locator Pixi took 148.8µs
    2025-07-31 09:42:48.460 [info] Locator Poetry took 2.8355ms
    2025-07-31 09:42:48.460 [info] Locator PyEnv took 1.3409ms
    2025-07-31 09:42:48.460 [info] Locator Venv took 102.5µs
    2025-07-31 09:42:48.460 [info] Locator VirtualEnv took 242.5µs
    2025-07-31 09:42:48.460 [info] Locator VirtualEnvWrapper took 119µs
    2025-07-31 09:42:48.460 [info] Locator WindowsRegistry took 20.1257ms
    2025-07-31 09:42:48.460 [info] Locator WindowsStore took 452µs
    2025-07-31 09:42:48.460 [info] Locator GlobalVirtualEnvs took 725µs
    2025-07-31 09:42:48.460 [info] Locator Locators took 67.2875ms
    2025-07-31 09:42:48.460 [info] Locator Path took 18.0477ms
    2025-07-31 09:42:48.460 [info] Locator Workspaces took 1.8079ms
    2025-07-31 09:42:48.460 [info] Using conda from cache: E:\cs\Anaconda\Scripts\conda.EXE
    2025-07-31 09:42:48.461 [info] Found base environment: E:\cs\Anaconda
    2025-07-31 09:42:48.461 [info] Found named environment: E:\cs\Anaconda\envs\dl
    2025-07-31 09:42:48.461 [info] Found named environment: E:\cs\Anaconda\envs\egd
    2025-07-31 09:42:48.461 [info] Found named environment: E:\cs\Anaconda\envs\egtt
    2025-07-31 09:42:48.461 [info] Found named environment: E:\cs\Anaconda\envs\llm
    2025-07-31 09:42:48.461 [info] Found named environment: E:\cs\Anaconda\envs\mmcv
    2025-07-31 09:42:48.461 [info] Found named environment: E:\cs\Anaconda\envs\trans
    2025-07-31 09:42:48.461 [info] Found named environment: E:\cs\Anaconda\envs\visual
    2025-07-31 09:42:48.478 [info] Telemetry: {"event":"RefreshPerformance","data":{"refreshPerformance":{"total":67,"breakdown":{"GlobalVirtualEnvs":0,"Locators":67,"Path":18,"Workspaces":1},"locators":{"Conda":66,"PipEnv":0,"Pixi":0,"Poetry":2,"PyEnv":1,"Venv":0,"VirtualEnv":0,"VirtualEnvWrapper":0,"WindowsRegistry":20,"WindowsStore":0}}}}
    2025-07-31 09:42:48.482 [info] Python API: Changed environment from dl (3.11.9) to dl (3.11.9) for: e:\cs\test
    2025-07-31 09:42:48.482 [info] Internal: Changed environment from dl (3.11.9) to dl (3.11.9) for: e:\cs\test
    2025-07-31 09:42:54.708 [info] Using conda from cache: E:\cs\Anaconda\Scripts\conda.EXE

    At the same time, it brought about unbearable delays for extension loading and code completion. After the setting, the new terminal still in base env. the activation still use a command conda activate.

    Image

    Before I don't need to any activation, the terminal activated in the selected python interpreter automatically and without conda init.

  7. supralune commented on Jul 31, 2025

    @supralune
    Author

    I notice #704 and microsoft/vscode-python#25291, I meet the same as the issue #704.

    I tried it, the settings below:

    "python.terminal.activateEnvironment": true,
    "python.useEnvironmentsExtension": true,
    "python-envs.terminal.autoActivationType": "shellStartup",

    and the .vscode/settings.json as shown
    { "python-envs.defaultEnvManager": "ms-python.python:conda", "python-envs.defaultPackageManager": "ms-python.python:conda", "python-envs.pythonProjects": [] }

    The command doesn't appear, but the shellstartup seems to have no effect. the python env of terminal isn't consistent with the selected python interpreter.

    Outputs of python and python env:

    2025-07-31 10:41:15.258 [info] Native locator: Refresh started
    2025-07-31 10:41:15.927 [info] > conda info --json
    2025-07-31 10:41:16.965 [info] > pyenv which python
    2025-07-31 10:41:16.965 [info] cwd: .
    2025-07-31 10:41:17.169 [info] Native locator: Refresh finished in 1912 ms
    2025-07-31 10:41:18.109 [info] Active interpreter [e:\cs\test]: e:\cs\Anaconda\envs\dl
    2025-07-31 10:41:23.117 [info] 正在启动 Pylance 语言服务器。
    2025-07-31 10:42:25.274 [info] > ~.anaconda\Scripts\conda.exe info --json
    2025-07-31 10:42:25.275 [info] > ~.conda\Scripts\conda.exe info --json
    2025-07-31 10:42:25.276 [info] > ~.condarc\Scripts\conda.exe info --json
    2025-07-31 10:42:25.278 [info] > ~\conda.ps1\Scripts\conda.exe info --json
    2025-07-31 10:42:25.977 [info] > E:\cs\Anaconda\Scripts\conda.exe info --json
    2025-07-31 10:42:28.596 [info] > E:\cs\Anaconda\condabin\conda.bat info --json
    2025-07-31 10:46:13.309 [info] Discover tests for workspace name: undefined - uri: c:\Users\wyc\AppData\Roaming\Code\User\settings.json
    2025-07-31 10:46:15.857 [info] Discover tests for workspace name: undefined - uri: c:\Users\wyc\AppData\Roaming\Code\User\settings.json
    2025-07-31 10:46:16.231 [info] Discover tests for workspace name: undefined - uri: c:\Users\wyc\AppData\Roaming\Code\User\settings.json
    2025-07-31 10:46:41.496 [info] Discover tests for workspace name: undefined - uri: c:\Users\wyc\AppData\Roaming\Code\User\settings.json
    2025-07-31 10:46:44.584 [info] Discover tests for workspace name: undefined - uri: c:\Users\wyc\AppData\Roaming\Code\User\settings.json
    2025-07-31 10:46:47.889 [info] Discover tests for workspace name: undefined - uri: c:\Users\wyc\AppData\Roaming\Code\User\settings.json
    2025-07-31 10:46:49.238 [info] Discover tests for workspace name: undefined - uri: c:\Users\wyc\AppData\Roaming\Code\User\settings.json
    2025-07-31 10:47:21.261 [info] Native locator: Refresh started
    2025-07-31 10:47:21.962 [info] > conda info --json
    2025-07-31 10:47:21.983 [info] > pyenv which python
    2025-07-31 10:47:21.983 [info] cwd: .
    2025-07-31 10:47:22.133 [info] Native locator: Refresh finished in 873 ms
    2025-07-31 10:47:22.152 [info] Active interpreter [e:\cs\test]: e:\cs\Anaconda\envs\dl\python.exe
    2025-07-31 10:47:22.152 [info] Active interpreter [e:\cs\test]: e:\cs\Anaconda\envs\dl
    2025-07-31 10:47:29.454 [info] 正在启动 Pylance 语言服务器。
    2025-07-31 10:48:12.898 [info] Discover tests for workspace name: test - uri: e:\cs\test\test.py
    2025-07-31 10:48:29.272 [info] Discover tests for workspace name: test - uri: e:\cs\test\test.py
    2025-07-31 10:49:15.174 [info] Discover tests for workspace name: test - uri: e:\cs\test\test.py
    2025-07-31 10:52:30.129 [info] Native locator: Refresh started
    2025-07-31 10:52:32.034 [info] > conda info --json
    2025-07-31 10:52:32.087 [info] > pyenv which python
    2025-07-31 10:52:32.087 [info] cwd: .
    2025-07-31 10:52:32.272 [info] Native locator: Refresh finished in 2143 ms
    2025-07-31 10:52:33.455 [info] Active interpreter [e:\cs\test]: e:\cs\Anaconda
    2025-07-31 10:53:18.921 [info] 正在启动 Pylance 语言服务器。
    2025-07-31 10:53:20.002 [info] Active interpreter [global]: e:\cs\Anaconda
    2025-07-31 10:53:20.002 [info] 正在启动 Pylance 语言服务器。
    2025-07-31 10:53:20.007 [info] 正在启动 Pylance 语言服务器。
    2025-07-31 10:53:20.021 [info] Active interpreter [e:\cs\test]: e:\cs\Anaconda\envs\dl\python.exe
    2025-07-31 10:53:20.021 [info] Active interpreter [e:\cs\test]: e:\cs\Anaconda\envs\dl
    2025-07-31 10:53:20.022 [info] Discover tests for workspace name: test - uri: e:\cs\test
    2025-07-31 10:53:46.363 [info] > ~.anaconda\Scripts\conda.exe info --json
    2025-07-31 10:53:46.364 [info] > ~.conda\Scripts\conda.exe info --json
    2025-07-31 10:53:46.365 [info] > ~.condarc\Scripts\conda.exe info --json
    2025-07-31 10:53:46.366 [info] > ~\conda.ps1\Scripts\conda.exe info --json
    2025-07-31 10:54:03.900 [info] > E:\cs\Anaconda\Scripts\conda.exe info --json
    2025-07-31 10:54:19.408 [info] > E:\cs\Anaconda\condabin\conda.bat info --json


    2025-07-31 10:52:32.264 [info] Locator Conda took 87.7246ms
    2025-07-31 10:52:32.265 [info] Locator PipEnv took 144.5µs
    2025-07-31 10:52:32.265 [info] Locator Pixi took 189.3µs
    2025-07-31 10:52:32.265 [info] Locator Poetry took 3.0783ms
    2025-07-31 10:52:32.265 [info] Locator PyEnv took 1.4205ms
    2025-07-31 10:52:32.265 [info] Locator Venv took 43.2µs
    2025-07-31 10:52:32.265 [info] Locator VirtualEnv took 80µs
    2025-07-31 10:52:32.265 [info] Locator VirtualEnvWrapper took 123.4µs
    2025-07-31 10:52:32.265 [info] Locator WindowsRegistry took 33.2988ms
    2025-07-31 10:52:32.265 [info] Locator WindowsStore took 602.9µs
    2025-07-31 10:52:32.265 [info] Locator GlobalVirtualEnvs took 1.2356ms
    2025-07-31 10:52:32.265 [info] Locator Locators took 88.0801ms
    2025-07-31 10:52:32.266 [info] Locator Path took 16.5621ms
    2025-07-31 10:52:32.266 [info] Locator Workspaces took 1.7695ms
    2025-07-31 10:52:32.266 [info] Using conda from cache: E:\cs\Anaconda\Scripts\conda.EXE
    2025-07-31 10:52:32.266 [info] Found base environment: E:\cs\Anaconda
    2025-07-31 10:52:32.266 [info] Found named environment: E:\cs\Anaconda\envs\dl
    2025-07-31 10:52:32.266 [info] Found named environment: E:\cs\Anaconda\envs\egd
    2025-07-31 10:52:32.266 [info] Found named environment: E:\cs\Anaconda\envs\egtt
    2025-07-31 10:52:32.266 [info] Found named environment: E:\cs\Anaconda\envs\llm
    2025-07-31 10:52:32.266 [info] Found named environment: E:\cs\Anaconda\envs\mmcv
    2025-07-31 10:52:32.266 [info] Found named environment: E:\cs\Anaconda\envs\trans
    2025-07-31 10:52:32.267 [info] Found named environment: E:\cs\Anaconda\envs\visual
    2025-07-31 10:52:32.284 [info] Telemetry: {"event":"RefreshPerformance","data":{"refreshPerformance":{"total":88,"breakdown":{"GlobalVirtualEnvs":1,"Locators":88,"Path":16,"Workspaces":1},"locators":{"Conda":87,"PipEnv":0,"Pixi":0,"Poetry":3,"PyEnv":1,"Venv":0,"VirtualEnv":0,"VirtualEnvWrapper":0,"WindowsRegistry":33,"WindowsStore":0}}}}
    2025-07-31 10:52:32.286 [info] Python API: Changed environment from base (3.11.7) to base (3.11.7) for: e:\cs\test
    2025-07-31 10:52:32.286 [info] Internal: Changed environment from base (3.11.7) to base (3.11.7) for: e:\cs\test
    2025-07-31 10:53:20.000 [info] Python API: Changed environment from base (3.11.7) to dl (3.11.9) for: e:\cs\test
    2025-07-31 10:53:20.000 [info] Internal: Changed environment from base (3.11.7) to dl (3.11.9) for: e:\cs\test
    2025-07-31 10:53:20.006 [info] Python API: Changed environment from undefined to base (3.11.7) for: global
    2025-07-31 10:53:20.006 [info] Internal: Changed environment from undefined to base (3.11.7) for: global

    Image

    Eleanor Boyd (@eleanorjboyd)

  8. eleanorjboyd commented on Jul 31, 2025

    @eleanorjboyd
    Member

    Just to summarize so far, the outstanding problems are:

    • the terminal don't activate in the desired python interpreter, but use the default base env of conda
    • Do not want to run conda init but terminal errors when running sourcing script & conda activate.
    1. What steps do you normally take to activate your environment given you don't want use conda init? The goal is that we are replicating behavior that you would desire in a normal terminal inside VS Code. Lets figure out why sourcing script & conda activate isn't working like is it different than what you normally run? If you run this in a separate terminal does it work?
    2. If you go over and click on the Python icon in the sidebar, what do you see there? Curious especially about the projects section and if everything there looks correct
    Image

    Thank you for your patience as we try and figure this out- it is greatly appreciated!

  9. supralune commented on Aug 1, 2025

    @supralune
    Author

    I don't need any activation for terminal in vscode before. It was activated with the selected python interpreter Implicitly, automatically. Fortunately, the extension worked properly in WSL as I expected.

    Image

    In Windows, the environment is not activated correctly in the terminal.

    Image

    The settings are same. Thank you for your answer. I hope terminal can be activated correctly in windows as it is in WSL. For more information please ask me.
    Eleanor Boyd (@eleanorjboyd)

  10. eleanorjboyd commented on Aug 12, 2025

    @eleanorjboyd
    Member

    Hello Everyone! Want to start by thanking you for your patience and help with debugging this conda issue. After assessing the whole problem, I did a rewrite of the conda activation, implementing it to fit with our new architecture but use prioritization like that for the old method. I have gone through testing with different OS, shells, and computers but know that there is still a good chance bugs may exist in the new code.

    With that being said, I would really appreciate you help testing the new code and letting me know if it works or the bugs. If you install the new pre-release of the python-environments extension and reload your window, you will have the new code. From there give it a try and if it doesn’t work, here are the steps to get me the necessary information for me to fix it. I have added extensive logging to hopefully make it easier:

    1. use developer: set log level command to set your log level to trace
    2. reload your window
    3. copy all the logs out of your python-environments extension output channel. (if you do not feel comfortable posting this I can share my email so you can reach out to me specifically or you can sanitize your logs)
    4. include what you expect to happen- so I can see where it went down the wrong path.

    Again, thank you so much and I hope the rewrite will be a step up from the previous implementation. Thank you

  11. supralune commented on Aug 14, 2025

    @supralune
    Author

    Eleanor Boyd (@eleanorjboyd)
    Thanks for your patient! I have selected the extension's logs, as shown below.

    2025-08-14 11:36:29.074 [info] Found base environment: E:\cs\Anaconda
    2025-08-14 11:36:29.074 [info] Found named environment: E:\cs\Anaconda\envs\dl
    2025-08-14 11:36:29.074 [info] Found named environment: E:\cs\Anaconda\envs\egd
    2025-08-14 11:36:29.074 [info] Found named environment: E:\cs\Anaconda\envs\egtt
    2025-08-14 11:36:29.075 [info] Found named environment: E:\cs\Anaconda\envs\llm
    2025-08-14 11:36:29.075 [info] Found named environment: E:\cs\Anaconda\envs\mmcv
    2025-08-14 11:36:29.075 [info] Found named environment: E:\cs\Anaconda\envs\trans
    2025-08-14 11:36:29.075 [info] Found named environment: E:\cs\Anaconda\envs\visual
    2025-08-14 11:36:29.082 [debug] Checking shell profile for pwsh.
    2025-08-14 11:36:29.100 [info] Python API: Changed environment from undefined to base (3.11.7) for: e:\cs\test
    2025-08-14 11:36:29.100 [info] Internal: Changed environment from undefined to base (3.11.7) for: e:\cs\test
    2025-08-14 11:36:29.239 [info] Found base environment: E:\cs\Anaconda
    2025-08-14 11:36:29.239 [info] Found named environment: E:\cs\Anaconda\envs\dl
    2025-08-14 11:36:29.239 [info] Found named environment: E:\cs\Anaconda\envs\egd
    2025-08-14 11:36:29.239 [info] Found named environment: E:\cs\Anaconda\envs\egtt
    2025-08-14 11:36:29.239 [info] Found named environment: E:\cs\Anaconda\envs\llm
    2025-08-14 11:36:29.239 [info] Found named environment: E:\cs\Anaconda\envs\mmcv
    2025-08-14 11:36:29.239 [info] Found named environment: E:\cs\Anaconda\envs\trans
    2025-08-14 11:36:29.239 [info] Found named environment: E:\cs\Anaconda\envs\visual
    2025-08-14 11:36:29.253 [info] Python API: Changed environment from base (3.11.7) to base (3.11.7) for: e:\cs\test
    2025-08-14 11:36:29.253 [info] Internal: Changed environment from base (3.11.7) to base (3.11.7) for: e:\cs\test
    2025-08-14 11:36:30.269 [debug] pwsh is not installed
    2025-08-14 11:37:52.073 [info] SHELL: powershell profile found at: C:\Users\wyc\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
    2025-08-14 11:37:52.074 [info] SHELL: powershell already contains activation code: C:\Users\wyc\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
    2025-08-14 11:37:52.074 [debug] Shell profile for pwsh is setup.
    2025-08-14 11:37:52.074 [debug] No shell profiles to setup for pwsh
    2025-08-14 11:40:04.060 [debug] Finder - from cache environments e:\cs\test
    2025-08-14 11:40:06.686 [info] Python API: Changed environment from base (3.11.7) to dl (3.11.9) for: e:\cs\test
    2025-08-14 11:40:06.686 [info] Internal: Changed environment from base (3.11.7) to dl (3.11.9) for: e:\cs\test
    2025-08-14 11:40:06.689 [info] Python API: Changed environment from undefined to base (3.11.7) for: global
    2025-08-14 11:40:06.689 [info] Internal: Changed environment from undefined to base (3.11.7) for: global


    When I launch a terminal(pwsh):
    2025-08-14 11:43:21.033 [debug] Shell startup is supported for pwsh, using shell startup activation
    2025-08-14 11:43:21.033 [debug] Shell profile for pwsh is already setup.
    2025-08-14 11:43:21.033 [info] "python-envs.terminal.autoActivationType" is set to "shellStartup", terminal should be activated by shell startup script


    When I launch cmd:
    2025-08-14 11:52:21.548 [debug] Checking Conda (ms-python.python:conda) for e:\cs\Anaconda\envs\dl\python.exe
    2025-08-14 11:52:21.550 [debug] Resolving env "e:\cs\Anaconda\envs\dl\python.exe"
    2025-08-14 11:52:21.550 [debug] In resolve_environment, looking for Python Env PythonEnv { executable: "E:\cs\Anaconda\envs\dl\python.exe", prefix: None, version: None, symlinks: None } in "e:\cs\Anaconda\envs\dl\python.exe"
    2025-08-14 11:52:21.550 [debug] Identifying Python environment using locators: "E:\cs\Anaconda\envs\dl\python.exe"
    2025-08-14 11:52:21.551 [debug] Using cache from "c:\Users\wyc\AppData\Roaming\Code\User\globalStorage\ms-python.vscode-python-envs\pythonLocator\2c7d40f39d34f264.3.json" for "E:\cs\Anaconda\envs\dl\python.exe"
    2025-08-14 11:52:21.551 [debug] In resolve_environment, Resolved Python Exe "E:\cs\Anaconda\envs\dl\python.exe" as ResolvedPythonEnv { executable: "E:\cs\Anaconda\envs\dl\python.exe", prefix: "E:\cs\Anaconda\envs\dl", version: "3.11.9.final.0", is64_bit: true, symlinks: Some(["E:\cs\Anaconda\envs\dl\python.exe"]) }
    2025-08-14 11:52:21.552 [debug] Resolved env (Ok(2.9868ms)) "e:\cs\Anaconda\envs\dl\python.exe" as PythonEnvironment { display_name: None, name: Some("dl"), executable: Some("E:\cs\Anaconda\envs\dl\python.exe"), kind: Some(Conda), version: Some("3.11.9.final.0"), prefix: Some("E:\cs\Anaconda\envs\dl"), manager: Some(EnvManager { executable: "E:\cs\Anaconda\Scripts\conda.exe", version: Some("24.1.2"), tool: Conda }), project: None, arch: Some(X64), symlinks: Some(["E:\cs\Anaconda\envs\dl\python.exe"]) }
    2025-08-14 11:52:21.552 [info] Resolved Python Environment E:\cs\Anaconda\envs\dl\python.exe
    2025-08-14 11:52:21.552 [info] Using conda from cache: E:\cs\Anaconda\Scripts\conda.EXE
    2025-08-14 11:52:21.553 [info] Found named environment: E:\cs\Anaconda\envs\dl
    2025-08-14 11:52:21.553 [debug] Using Conda (ms-python.python:conda) to handle e:\cs\Anaconda\envs\dl\python.exe
    2025-08-14 11:52:25.308 [debug] Shell startup is supported for cmd, using shell startup activation
    2025-08-14 11:52:25.308 [debug] Checking shell profile for cmd.
    2025-08-14 11:52:25.309 [debug] Shell profile for cmd is not setup.
    2025-08-14 11:52:25.309 [debug] Shell profile for cmd is not set up, using command fallback.
    2025-08-14 11:52:26.037 [debug] Activating terminal: e:\cs\Anaconda\envs\dl
    2025-08-14 11:52:26.037 [info] Terminal is activated: e:\cs\Anaconda\envs\dl
    2025-08-14 11:52:26.875 [debug] User chose to set up shell profiles for cmd shells
    2025-08-14 11:52:26.883 [info] SHELL: CMD activation file at C:\Users\wyc.cmdrc\vscode-python.bat already contains activation code
    2025-08-14 11:52:26.921 [info] SHELL: CMD AutoRun registry key already contains our main batch file

    What puzzled me is that the log shows 'pwsh is not installed'. Yet one time, when I launched cmd, it was activated with python env.

    So the problem seems to be that the environment is not activated in the correct terminal, pwsh is not recognized.

    The extension's log shows the environment path as follows:

    2025-08-14 11:28:35.873 [debug] Env PATH: ["C:\Program Files\PowerShell\7-preview\preview", "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin", "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\libnvvp", "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin", "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\libnvvp", "C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler", "C:\Windows\system32", "C:\Windows", "C:\Windows\System32\Wbem", "C:\Windows\System32\WindowsPowerShell\v1.0\", "C:\Windows\System32\OpenSSH\", "C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common", "C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR", "C:\Program Files\dotnet\", "C:\WINDOWS\system32", "C:\WINDOWS", "C:\WINDOWS\System32\Wbem", "C:\WINDOWS\System32\WindowsPowerShell\v1.0\", "C:\WINDOWS\System32\OpenSSH\", "C:\MinGW\mingw64\bin", "D:\Microsoft VS Code\bin", "E:\Matlab\bin", "D:\Widget\typst-x86_64-pc-windows-msvc", "C:\Program Files\starship\bin\", "E:\cs\Anaconda", "E:\cs\Anaconda\Scripts", "E:\cs\Anaconda\Library\bin", "E:\cs\Anaconda\Library\mingw-w64\bin", "E:\cs\Anaconda\Library\usr\bin", "C:\Program Files\Microsoft SQL Server\150\Tools\Binn\", "C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\", "C:\Users\wyc\.cargo\bin", "C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.2.0\", "D:\nodejs\", "E:\Computer\Git\cmd", "C:\Program Files\Docker\Docker\resources\bin", "C:\Users\wyc\AppData\Local\Microsoft\WindowsApps", "E:\cs\PyCharm Community Edition 2024.2\bin", "E:\JetBrains\IntelliJ IDEA 2024.3.1\bin"]

  12. eleanorjboyd commented on Aug 14, 2025

    @eleanorjboyd
    Member

    I am seeing in your logs "python-envs.terminal.autoActivationType" is set to "shellStartup", terminal should be activated by shell startup script, for pwsh. Can you check your pwsh profile to see if there is anything there that says it was inserted by VS Code? With shell startup set, we change the shell profile script to handle activation, if instead "command" is used then we run the sourcing command (like path/to/activate).

    Image
  13. supralune commented on Aug 15, 2025

    @supralune
    Author

    The image shows everything in "C:\Users\wyc\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
    Image
    I think the key of problem is that the activation doesn't run in desired terminal(pwsh instead of cmd) properly as I mentioned before.

  14. 32 remaining items

  15. eleanorjboyd commented on Feb 4, 2026

    @eleanorjboyd
    Member

    This thread has gotten a bit long with back and forth so I wanted to try and summarize and outline actions items.

    It seems like what if fixed is:

    • environment activation recognizing powershell7preview
    • interpreter is correctly selected in the environment extension tab and points to the specific conda environment you intend to use

    which leads me to the outstanding question: What is still broken? Is the activation still not working even with the powershell7preview being recognized?

    I also think some background here could help on our conda intended design- this is a bit verbose but I think it summarizes what we have talked about and the goal of I think what we all agree is how things should work. If you are still seeing an issue it is likely at the place of we skip command fallback because we think "pwsh is already setup" but we are checking the wrong shell

    background:
    step 1 sourcing conda: this is a shell hook that makes conda activate work in your shell activate a specific conda environment conda activate name_of_env
    For the first step, there are a few ways you can achieve this:
    A. if you run conda init in the shell you are using it will make an edit to your shell profile file and handle the sourcing (that is the code you see in between the # >>> conda initialize >>> tags in your bashrc. This will be permanent as long as that code is in your shell profile and will apply to just that shell and that is what you DONT want to do
    B. running the shell hook to source conda in a specific terminal instance. This will ONLY impact your currently open shell and does not last.

    step 2 activation: same all around

    Given the two paths to achieve sourcing conda, we attempt to determine if we need to source conda when a user creates a new terminal or if we can just do step 2 and activate it.

  16. supralune commented on Feb 9, 2026

    @supralune
    Author

    Thanks for the detailed summary and background context.

    To answer your outstanding question: Yes, the activation is still broken.

    It appears that Step 1 (sourcing conda) is being skipped. Even though the environment is recognized, the shell hook isn't running for the new terminal instance.

    As shown in the attached screenshot:

    1. I am encountering the error: CondaError: Run 'conda init' before 'conda activate'.
    2. My $PROFILE is clean (only encoding settings), confirming I am not using "Path A" (permanent conda init).

    This aligns with your hypothesis: the extension likely skips the command fallback because it incorrectly assumes pwsh is already setup/initialized, but it is not. Let me know if you need any logs or further environment details!
    Image

  17. eleanorjboyd commented on Feb 9, 2026

    @eleanorjboyd
    Member

    Hi! This is great info and I think we are closing in on the bug- I appreciate all your help! To confirm- what is the value of your setting: python-envs.terminal.autoActivationType. I think it's "shell startup" and if so could you echo the following env var in a terminal you open "VSCODE_PYTHON_PWSH_ACTIVATE"? Here Anthony Kim (@anthonykim1) can help as the expert in shell integration.

    If you have "command" for the activation setting, then could you turn on trace logging and get the output from "python environments extension"? You can turn on trace logging by going to the command palette and selecting "developer: set log level. Next, go to the output with "view: toggle output" and select "python environments" from the dropdown. You should see a section like === Conda Shell Activation Map Generation === in that logs that will have all the info of what commands we determined were needed per shell. If we are now recognizing your shell correctly then we are just not getting the right sourcing script. Inside that section hopefully we can look for these logs specifically to know what incorrect sourcing command is being generated:

    • Local Activation
    • Preferred Sourcing
    • PS1 hook path:
    • Windows activation commands
    • Conda hook found at: ...

    Thank you for continuing to respond and helping us find this bug!

  18. supralune commented on Feb 11, 2026

    @supralune
    Author

    Thanks for the instructions.

    I have checked my settings and run the command as requested:

    1. My python-envs.terminal.autoActivationType is indeed set to "shellStartup".
    2. I ran echo $env:VSCODE_PYTHON_PWSH_ACTIVATE in the terminal, and it returned nothing (empty value).

    Please see the attached screenshot for confirmation. It seems the environment variable is not being injected/set correctly for this shell instance.

    Image
  19. added
    area-activationIssue related to activation. Root cause can be from interpreter selection or activation in terminal
    and removed on Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-activationIssue related to activation. Root cause can be from interpreter selection or activation in terminalbugIssue identified by VS Code Team member as probable bugimportantIssue identified as high-priorityneeds spike

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions