Thanks to visit codestin.com
Credit goes to github.com

Skip to content

The anaconda environment is not activated automatically when I open the terminal. Although I can see the environment name in terminal, it is not actually activated. The which python command output the base env of the anaconda. #25052

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

Closed
zhanglixuan0720 opened this issue May 12, 2025 · 4 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@zhanglixuan0720
Copy link

Type: Bug

Behaviour

Open the terminal and find the python virtual env is not activated.

Steps to reproduce:

  1. Select the anaconda virtual python environment

  2. Open one terminal.

  3. type which python in the CML and find the output is the base env instead of configured env.

Extension version: 2025.6.0
VS Code version: Code 1.100.0 (19e0f9e681ecb8e5c09d8784acaa601316ca4571, 2025-05-07T12:48:53.763Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 5.15.0-127-generic
Connection to 'SSH: lixuan-V100' could not be established The remote host does not meet the prerequisites for running VS Code Server

  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.20
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
copilot Git 1.317.0
copilot-chat Git 0.27.0
dart-code Dar 3.110.0
debugpy ms- 2025.8.0
docker doc 0.6.0
flutter Dar 3.110.0
git-graph mhu 1.30.0
js-debug ms- 1.100.0
python ms- 2025.6.0
rainbow-csv mec 3.19.0
vscode-docker ms- 1.29.6
vscode-js-profile-table ms- 1.0.10
vscode-language-pack-zh-hans MS- 1.100.2025050709
vscode-pylance ms- 2025.4.1
System Info
Item Value
CPUs Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208)
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
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.88GB (4.22GB free)
Process Argv --crash-reporter-id 0d8a2738-fd2a-42a9-ae55-931ac16a44ca
Screen Reader no
VM 40%
Item Value
Remote SSH: lixuan-4090-3
OS Linux x64 5.15.0-127-generic
CPUs AMD EPYC 9654 96-Core Processor (384 x 3694)
Memory (System) 1007.50GB (880.58GB free)
VM 0%

Connection to 'SSH: lixuan-V100' could not be established The remote host does not meet the prerequisites for running VS Code Server

A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupyter:31046869
pythonrstrctxt:31112756
nativeloc2:31192216
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
e5gg6876:31282496
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
31787653:31262186
3e8i5726:31271747
996jf627:31283433
pythonrdcb7cf:31303019
usemplatestapi:31297334
7bj51361:31289155
747dc170:31275177
g20af354:31278749
pylancecolorcf:31303817
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004
xtabfftm10-2:31302953

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label May 12, 2025
@karthiknadig
Copy link
Member

@zhanglixuan0720 Please share logs from Output > Python

Also try workarounds recommend in : #24699

@karthiknadig karthiknadig self-assigned this May 12, 2025
@github-actions github-actions bot added the info-needed Issue requires more information from poster label May 12, 2025
@zhanglixuan0720
Copy link
Author

@karthiknadig Thank you for your response. I followed the workaround recommended in GitHub issue #24699 but unfortunately, it did not resolve the issue.

Below, I’ve shared the logs from Output > Python, which might help in diagnosing the problem.
Logs from Output > Python:

2025-05-12 13:04:15.627 [info] Experiment 'pythonaacf' is active
2025-05-12 13:04:15.627 [info] Experiment 'pythonRecommendTensorboardExt' is active
2025-05-12 13:04:15.627 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-05-12 13:04:15.627 [warning] Dir "/home/zhanglixuan/nav/calvin/.pixi/envs" is not watchable (directory does not exist)
2025-05-12 13:04:15.627 [info] Python interpreter path: ~/anaconda3/envs/calvin/bin/python
2025-05-12 13:04:56.103 [info] > pyenv which python
2025-05-12 13:04:56.103 [info] cwd: .
2025-05-12 13:04:57.034 [info] > conda info --json
2025-05-12 13:04:57.034 [info] shell: bash
2025-05-12 13:04:57.705 [info] > conda run -p ~/anaconda3/envs/calvin --no-capture-output python /data/zhanglixuan/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/get_output_via_markers.py /data/zhanglixuan/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/printEnvVariables.py
2025-05-12 13:04:57.706 [info] shell: bash
2025-05-12 13:05:14.870 [info] > /bin/python3 /data/zhanglixuan/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/printEnvVariables.py
2025-05-12 13:05:14.870 [info] shell: bash
2025-05-12 13:05:14.960 [info] Setting environment variable CONDA_ROOT in collection to /home/zhanglixuan/anaconda3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-12 13:05:14.960 [info] Setting environment variable CONDA_PREFIX in collection to /home/zhanglixuan/anaconda3/envs/calvin {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-12 13:05:14.960 [info] Setting environment variable CONDA_PROMPT_MODIFIER in collection to (calvin)  {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-12 13:05:14.960 [info] Setting environment variable CONDA_SHLVL in collection to 2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-12 13:05:14.960 [info] Setting environment variable CONDA_DEFAULT_ENV in collection to calvin {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-12 13:05:14.960 [info] Prepending environment variable PATH in collection to /data/zhanglixuan/.vscode-server/cli/servers/Stable-19e0f9e681ecb8e5c09d8784acaa601316ca4571/server/bin/remote-cli:/home/zhanglixuan/bin:/home/zhanglixuan/.cargo/bin:/data/zhanglixuan/bin/google-cloud-sdk/bin:/home/zhanglixuan/anaconda3/envs/calvin/bin:/home/zhanglixuan/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zhanglixuan/bin:/home/zhanglixuan/tools/aliyunpan/aliyunpan-v0.3.6-linux-386:/home/zhanglixuan/bin/ngrok:/home/zhanglixuan/bincpolar:/home/zhanglixuan/tools/x_tools/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-12 13:05:14.960 [info] Setting environment variable CONDA_PREFIX_1 in collection to /home/zhanglixuan/anaconda3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-12 13:05:14.960 [info] Prepending environment variable PS1 in collection with (calvin)  {"applyAtShellIntegration":true,"applyAtProcessCreation":false}
2025-05-12 13:05:14.960 [info] Send text to terminal: /bin/python3 /data/zhanglixuan/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/printEnvVariablesToFile.py /data/zhanglixuan/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/deactivate/bash/envVars.txt
2025-05-12 13:05:15.046 [info] Starting Pylance language server.
2025-05-12 13:05:15.056 [info] > conda info --json

This issue only started after updating VS Code to the latest version today. I suspect that this may be related to changes in the new version of VS Code, as the issue did not appear prior to the update. My VS Code version information is as follows:

Version: 1.100.0 (user setup)
Commit: 19e0f9e681ecb8e5c09d8784acaa601316ca4571
Date: 2025-05-07T12:48:53.763Z
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.19045

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label May 12, 2025
@karthiknadig
Copy link
Member

@zhanglixuan0720 Did you add "python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"] to User Settings? from the logs it looks like the setting was not added. If you added it to Workspace settings Please move it to user settings, and Reload VS Code.

It could be that there is some issue with activation caused by some changes to VS Code 1.100. But the above setting should help with this.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label May 12, 2025
@zhanglixuan0720
Copy link
Author

@karthiknadig Thank you for your solution. I added the setting "python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"] to the User Settings. After waiting for a while with the terminal open (likely due to the plugin starting up), the problem has been resolved.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants