Repository navigation
Code debugging starts before conda env activates #895
Copy link
Copy link
Closed as not planned
Labels
info-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
Type: Bug
Behaviour
When trying to debug a .py file in conda environment on Windows 11, the debugger runs the python file before conda activate <env>.
In detail, there are two conda activating commands that the Python extension will automatically run:
<conda env path>/Scripts/activate
conda activate <env name>But when debugging a Python code, the debugger starts after <conda env path>/Scripts/activate but before conda activate <env name>, which may cause some incorrect environment settings, like a wrong PATH and cannot find dynamic link libraries.
Steps to reproduce:
- Ensure conda has been installed.
- Select a conda environment's python exe as the python interpreter for
.py - Debug a
.pyfile.
Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
PS D:\program\Python\auto-workflows> D:/program/Python/anaconda/envs/math_model/Scripts/activate
PS D:\program\Python\auto-workflows> & 'd:\program\Python\anaconda\envs\workflow\python.exe' 'c:\Users\Sunlight\.vscode\extensions\ms-python.debugpy-2025.10.0-win32-x64\bundled\libs\debugpy\launcher' '8419' '--' 'd:\program\Python\auto-workflows\helloworld.py'
Hello World
PS D:\program\Python\auto-workflows> conda activate workflow
(workflow) PS D:\program\Python\auto-workflows>
Extension version: 2025.11.2025072501
VS Code version: Code 1.102.2 (c306e94f98122556ca081f527b466015e1bc37b0, 2025-07-22T12:15:48.520Z)
OS version: Windows_NT x64 10.0.26100
Modes:
System Info
| Item | Value |
|---|---|
| CPUs | 12th Gen Intel(R) Core(TM) i7-12700H (20 x 2688) |
| 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.63GB (3.50GB free) |
| Process Argv | --crash-reporter-id 59651958-9740-4efc-af64-7724da49518f |
| Screen Reader | no |
| VM | 50% |
A/B Experiments
vsliv368cf:30146710
pythonvspyt551:31249599
binariesv615:30325510
2e7ec940:31000449
nativeloc1:31344060
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
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
pylancequickfixt:31350061
9d2cg352:31346308
convertlamdat:31350063
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31350858
nes-diff-11:31337487
replacestringexc:31350595
nes-set-on:31351930
testaa123:31335226
6abeh943:31336334
yijiwantestdri0626-t:31336930
0927b901:31350571
ji9b5146:31348712
0cj2b977:31352657
0574c672:31355360
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
info-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Activity
yonatan-rozenek commentedon Jul 28, 2025
I experience a similar issue on linux which causes the debugger to sometimes run before my
.zshrcfile. This file also contains myconda initlogic and therefore causes similar issue.eleanorjboyd commentedon Aug 4, 2025
Hi! Can you check to see if the behavior changes if you disable the "Python Environments Extension?"?
yonatan-rozenek commentedon Aug 5, 2025
TL;DR Disabling the Powerlevel10k Instant Prompt feature resolved the issue for me.
In my case, the issue was caused by the Instant Prompt feature of Powerlevel10k. It seems that this feature caused my
.zshrcto execute in a non-blocking way, allowing subsequent Zsh commands (such as debugging) to run before it finished. I also noticed that sometimes the conda environment attempted to activate before the.zshrcinit code had fully run, which also led me to suspect that my.zshrcwasn’t blocking as expected.Sunlight-zero commentedon Aug 5, 2025
No. After disabling
Python Environments Extension, the problem still exists.eleanorjboyd commentedon Aug 13, 2025
Sunlight Zero (@Sunlight-zero) are you using something similar to @yonaroz like Powerlevel10k Instant Prompt?
cc Anthony Kim (@anthonykim1)
Sunlight-zero commentedon Aug 15, 2025
Eleanor Boyd (@eleanorjboyd) I have disabled or uninstalled all other plugins and left
PythonandPython Debuggeronly, but the problem still exists.eleanorjboyd commentedon Dec 12, 2025
Hi! Are people still experiencing this issue?
vs-code-engineering commentedon Dec 20, 2025
This issue has been closed as it has been labeled with
info-neededand has not received the additional information that was requested from the issue author. It has been labeled asinfo-neededfor 7 days.