Repository navigation
External cmdline will be launched when the plugin automaticly activate conda environment #704
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from posterIssue requires more information from poster
Description
Type: Bug
Behaviour
It is expected to see intergrated terminal launched with conda env activated and with no more infomation, but:
- Command "/anaconda/Scripts/activate" and "conda activate envname" can be seen when intergrated terminal launched. (These couldn't be seen before)
- External cmdline popped up when "/anaconda/Scripts/activate" is processed. (Though it may seems normal when you try to do the same in any other terminal, these process couldn't be seen before and it is annoying, and i have already set "conda init" for pwsh)
Edit: It is also expected to keep conda env activated when vscode restart, but i need to restart terminal to recover. All of above problems except "/anaconda/Scripts/activate" also happened when using with wsl.
Steps to reproduce:
- Open a folder in VSCode
- Set a conda environment for the workspace
- Open the intergated terminal and you can see what happens
Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2025-07-20 10:34:29.182 [info] 试验“pythonTerminalEnvVarActivationcf”处于活动状态
2025-07-20 10:34:29.182 [info] Native locator: Refresh started
2025-07-20 10:34:29.768 [info] > pyenv which python
2025-07-20 10:34:29.768 [info] cwd: .
2025-07-20 10:34:29.894 [info] > conda info --json
2025-07-20 10:34:29.959 [info] Conda environment manager found at: D:\anaconda\Scripts\conda.exe
2025-07-20 10:34:29.959 [info] Using conda: D:\anaconda\Scripts\conda.exe
2025-07-20 10:34:33.044 [info] Native locator: Refresh finished in 4853 ms
2025-07-20 10:34:33.087 [info] > D:\anaconda\Scripts\conda.exe info --json
2025-07-20 10:34:35.964 [info] Python 解释器路径: D:\anaconda\envs\Practice\python.exe
2025-07-20 10:34:37.146 [info] 正在启动 Pylance 语言服务器。
2025-07-20 10:34:38.588 [info] Send text to terminal: D:/anaconda/Scripts/activate
2025-07-20 10:34:39.091 [info] Send text to terminal: conda activate Practice
Extension version: 2025.10.0
VS Code version: Code 1.102.1 (7adae6a56e34cb64d08899664b814cf620465925, 2025-07-15T16:41:17.147Z)
OS version: Windows_NT x64 10.0.26100
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.23
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
- Value of the
python.languageServersetting: Default
User Settings
languageServer: "Pylance"
Installed Extensions
| Extension Name | Extension Id | Version |
|---|---|---|
| arm | dan | 1.7.4 |
| autopep8 | ms- | 2025.2.0 |
| background | sha | 2.0.3 |
| better-cpp-syntax | jef | 1.27.1 |
| black-formatter | ms- | 2025.2.0 |
| codespaces | Git | 1.17.3 |
| copilot | Git | 1.344.0 |
| copilot-chat | Git | 0.29.1 |
| cortex-debug | mar | 1.12.1 |
| cpptools | ms- | 1.26.3 |
| cpptools-extension-pack | ms- | 1.3.1 |
| cpptools-themes | ms- | 2.0.0 |
| darkpp-italic | idb | 0.2.1 |
| data-workspace-vscode | ms- | 0.6.3 |
| datawrangler | ms- | 1.22.0 |
| debug-tracker-vscode | mcu | 0.0.15 |
| debugpy | ms- | 2025.10.0 |
| doxdocgen | csc | 1.4.0 |
| emoji-icons | mig | 1.6.1 |
| eva-theme | fis | 2.7.9 |
| github-vscode-theme | Git | 6.3.5 |
| gnu-mapfiles | tro | 1.1.0 |
| gruvbox | jdi | 1.28.0 |
| hexeditor | ms- | 1.11.1 |
| horizon-theme-vscode | ale | 1.0.1 |
| html-preview-vscode | geo | 0.2.5 |
| icons-carbon | ant | 0.2.6 |
| intellicode-api-usage-examples | Vis | 0.2.9 |
| isort | ms- | 2025.0.0 |
| java | red | 1.43.1 |
| js-debug | ms- | 1.102.0 |
| js-debug-companion | ms- | 1.1.3 |
| jupyter | ms- | 2025.6.0 |
| jupyter-keymap | ms- | 1.1.2 |
| jupyter-renderers | ms- | 1.3.0 |
| keil-assistant | cl | 1.7.0 |
| latex-workshop | Jam | 10.10.0 |
| linkerscript | Zix | 1.0.4 |
| macos-modern-theme | dav | 2.3.19 |
| markdown-preview-enhanced | shd | 0.8.18 |
| material-icon-theme | PKi | 5.24.0 |
| material-product-icons | PKi | 1.7.1 |
| material-theme | zhu | 3.19.0 |
| memory-view | mcu | 0.0.25 |
| moegi-theme | ddi | 0.7.1 |
| monochrome | ano | 2.4.3 |
| mssql | ms- | 1.33.0 |
| night-owl | sdr | 2.1.1 |
| peripheral-viewer | mcu | 1.4.6 |
| prettier-vscode | esb | 11.0.0 |
| pyqt-integration | zho | 0.2.0 |
| python | ms- | 2025.10.0 |
| rainbow-csv | mec | 3.20.0 |
| remote-explorer | ms- | 0.5.0 |
| remote-ssh | ms- | 0.120.0 |
| remote-ssh-edit | ms- | 0.87.0 |
| remote-wsl | ms- | 0.99.0 |
| rose-pine | mvl | 2.14.0 |
| rtos-views | mcu | 0.0.7 |
| sequoia | wic | 1.31.0 |
| sql-bindings-vscode | ms- | 0.4.1 |
| sql-database-projects-vscode | ms- | 1.5.3 |
| Theme-MarkdownKit | ms- | 0.1.4 |
| theme-panda | tin | 1.4.0 |
| theme-vitesse | ant | 0.8.3 |
| vscode-eslint | dba | 3.0.10 |
| vscode-fix-checksums-next | Rim | 1.4.0 |
| vscode-gradle | vsc | 3.16.4 |
| vscode-java-debug | vsc | 0.58.2 |
| vscode-java-dependency | vsc | 0.24.1 |
| vscode-java-pack | vsc | 0.29.2 |
| vscode-java-test | vsc | 0.43.1 |
| vscode-jetbrains-icon-theme | cha | 2.33.0 |
| vscode-js-profile-table | ms- | 1.0.10 |
| vscode-jupyter-cell-tags | ms- | 0.1.9 |
| vscode-jupyter-powertoys | ms- | 0.1.1 |
| vscode-jupyter-slideshow | ms- | 0.1.6 |
| vscode-language-pack-zh-hans | MS- | 1.102.2025071609 |
| vscode-maven | vsc | 0.44.0 |
| vscode-office | cwe | 3.5.4 |
| vscode-pylance | ms- | 2025.6.2 |
| vscode-sqlite | ale | 0.14.1 |
| vscodeintellicode | Vis | 1.3.2 |
| webstorm-icons | pms | 1.0.0 |
| win-opacity | ska | 1.1.7 |
| winteriscoming | joh | 1.4.4 |
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 7 6800H with Radeon Graphics (16 x 3194) |
| 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.25GB (2.76GB free) |
| Process Argv | --crash-reporter-id bba39a52-efa9-4055-b69e-131b7b2f071c |
| Screen Reader | no |
| VM | 25% |
A/B Experiments
vsliv368:30146709
vswsl492cf:30256860
binariesv615:30325510
vscrp:30673768
0bi6i642:31350688
h48ei257:31000450
nativeloc1:31344060
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
hdaa2157:31222309
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
pythonpulldiag:31343502
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
6518g693:31334701
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
pylancequickfixf:31350060
9d2cg352:31346308
convertlamdaf:31350062
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31350861
nes-diff-11:31337487
replacestringexc:31350595
6abeh943:31336334
yijiwantestdri0626-c:31336931
0927b901:31350571
ji9b5146:31348712
0cj2b977:31350606
05h3e699-none:31350620
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from posterIssue requires more information from poster
Activity
HosamaJJF commentedon Jul 20, 2025
Just in case, i installed VSCode Insider with nothing added and installed pre-release version of vscode-python and it turns out:
We can still see the command shown, which is supposed to be hidden. Fortunately it uses another command to activate the env and in this way it wont launch cmdline.
and when i restart VSCode it automatically recovered the env.
Then i rolled back to the release version of vscode-python, and all the problems back again.
Then i tried to install the pre-release version of vscode-python in the release version of VSCode, the problems is still the same.
I don't know what excactly causes the diffrences, everything is just fine a week ago. I tried to roll back the plugin to an older version, and the problems still remains. The only thing I can remember may have an influence on my environment is that i have installed docker desktop.
HosamaJJF commentedon Jul 20, 2025
I've made a wrong that I haven't added "python.useEnvironmentsExtension": true to my user settings, so the plugin vscode-python-environments bundled with the pre-release version wasn't activated. Now I meet the same situation i've met in the VSCode Insider. It seems this new plugin bundled with vscode-python pre-release can solve my problem to some degree. But i still don't know why the original plugin goes wrong and the command to activate conda env just keep showing in the terminal.
HosamaJJF commentedon Jul 20, 2025
Whats new:
I found a setting "python-envs.terminal.autoActivationType" in vscode-python-environments. I turned it to "shellStartup". It didn't work at first and I found the shell script was witten to "C:\Users\Username\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1", but i am using Powershell 7 so I copied the script to "C:\Users\Username\Documents\PowerShell\Microsoft.PowerShell_profile.ps1", and everything worked as what they looks like before.
I will keep this issue open so you can notice this problem and do something to the release version if you have no plan to release these pre-release features in a short days.
Thank you for your contributions!
eleanorjboyd commentedon Jul 21, 2025
Thank you for updating this issue as you went and I am very glad to hear you found the right setting! Anthony Kim (@anthonykim1) - is there a way we can make sure the right shell script is edited? Or allow users to pick which one is?
anthonykim1 commentedon Jul 28, 2025
Eleanor Boyd (@eleanorjboyd) I think we might have a bug in locating which ps1 to put the shell flag in
eleanorjboyd commentedon Jul 28, 2025
Doing investigation, seems like the right profile path is not being set. https://github.com/eleanorjboyd/vscode-python-environments/blob/9b7273c9481dac140fbe095c6f16c17e7c70cb09/src/features/terminal/shells/pwsh/pwshStartup.ts#L82-L83
The logs you sent were from the python extension right? Could you attach your python environment ext logs also at info level? This will give me some insight into how it is getting that shell value
yayoinoyume commentedon Aug 11, 2025
I have also encountered this issue; I don't know when it started, but every time the virtual environment is activated, an External cmdline window will be launched. I now have no idea how to fix this problem.
eleanorjboyd commentedon Aug 11, 2025
currently working here and hope this will help as it should get the correct activation steps: #693.
I will circle back when it is merged and hopefully you can test it and let me know if it is actually the fix
WaterMinding commentedon Aug 12, 2025
HosamaJJF
Hello, I want to ask a question, how did you make your python-env extension search conda-hook.ps1 in the correct path?
My extension always try to find it in D:\Tools\Anaconda\ Library \shell\condabin\
HosamaJJF commentedon Aug 12, 2025
WaterMinding (@WaterMinding) Sorry I did nothing and the extension just found it. There's no folder named shell in Library on my computer.
WaterMinding commentedon Aug 12, 2025
HosamaJJF Thanks for your answer. There is no folder named shell in Library on my computer, either. But my extension just want to find it in Library.
eleanorjboyd commentedon Aug 12, 2025
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:
developer: set log levelcommand to set your log level to traceAgain, thank you so much and I hope the rewrite will be a step up from the previous implementation. Thank you
likesnow97 commentedon Aug 13, 2025
I didn't find this setting-"python-envs.terminal.autoActivationType" in my vscode. Is it because this setting does not exist in the new version of vscode?
eleanorjboyd commentedon Aug 13, 2025
You will need to have the python environments extension, so both install that extension and include the setting
python.useEnvironmentsExtension: truein your user settings. Are you able to see it then?likesnow97 commentedon Aug 14, 2025
Thank you so much, I can see it now!
github-actions commentedon Aug 30, 2025
Hey Anthony Kim (@anthonykim1), this issue might need further attention.
HosamaJJF, you can help us out by closing this issue if the problem no longer exists, or adding more information.
github-actions commentedon Sep 14, 2025
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.
Happy Coding!