Repository navigation
Python environment terminal activation breaks debugger launch #25192
Description
Type: Bug
Behaviour
Launching the python debugger (from a launch config or the button in the editor) when using "python.terminal.activateEnvironment": true and a Pixi environment does not work.
The debugger server is launched, but times out because the actual python command run in the terminal is flawed:
As you can see, the command is prepended with the Pixi shell activation command and run as a whole.
The pixi shell ... command does not run code, it only activates the environment.
I believe the intended behavior is to prepent the pixi run ... command.
Steps to reproduce:
- Create a Pixi environment.
- Select the created environment using the "Python: Select Interpreter" command.
- Set the
"python.terminal.activateEnvironment": truesetting. - Launch any python file for debugging.
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-06-19 10:01:52.541 [info] Not enabling terminal env var experiment in multiroot remote workspaces
2025-06-19 10:01:52.544 [info] Send text to terminal: /home/pan/.pixi/bin/pixi shell --manifest-path /home/pan/repositories/Booster-AI/pixi.toml --environment booster-ai-development
2025-06-19 10:01:53.143 [info] Send text to terminal: /usr/bin/env /home/pan/repositories/Booster-AI/.pixi/envs/booster-ai-development/bin/python /home/pan/.vscode-server/extensions/ms-python.debugpy-2025.8.0/bundled/libs/debugpy/adapter/../../debugpy/launcher 57177 -- -m deployment.scripts.build_and_push_docker_environment --environment civil_assistant_indexer --fetch-local-token --build-only --output-file ./_output/built_image.json
Output for Python Debugger in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python Debugger)
2025-06-19 09:41:13.840 [info] Resolving launch configuration with substituted variables
2025-06-19 09:41:13.857 [info] DAP Server launched with command: /home/pan/repositories/Booster-AI/.pixi/envs/booster-ai-development/bin/python /home/pan/.vscode-server/extensions/ms-python.debugpy-2025.8.0/bundled/libs/debugpy/adapter
2025-06-19 09:41:13.959 [info] Received 'debugpySockets' event from debugpy.
2025-06-19 09:41:13.963 [info] Received 'debugpySockets' event from debugpy.
2025-06-19 09:41:13.963 [info] Received 'debugpySockets' event from debugpy.
2025-06-19 09:48:22.440 [info] Resolving launch configuration with substituted variables
2025-06-19 09:48:22.454 [info] DAP Server launched with command: /home/pan/repositories/Booster-AI/.pixi/envs/booster-ai-development/bin/python /home/pan/.vscode-server/extensions/ms-python.debugpy-2025.8.0/bundled/libs/debugpy/adapter
2025-06-19 09:48:22.599 [info] Received 'debugpySockets' event from debugpy.
2025-06-19 09:48:22.604 [info] Received 'debugpySockets' event from debugpy.
2025-06-19 09:48:22.605 [info] Received 'debugpySockets' event from debugpy.
2025-06-19 10:01:52.251 [info] Resolving launch configuration with substituted variables
2025-06-19 10:01:52.270 [info] DAP Server launched with command: /home/pan/repositories/Booster-AI/.pixi/envs/booster-ai-development/bin/python /home/pan/.vscode-server/extensions/ms-python.debugpy-2025.8.0/bundled/libs/debugpy/adapter
2025-06-19 10:01:52.470 [info] Received 'debugpySockets' event from debugpy.
2025-06-19 10:01:52.473 [info] Received 'debugpySockets' event from debugpy.
2025-06-19 10:01:52.475 [info] Received 'debugpySockets' event from debugpy.
Extension version: 2025.8.0
VS Code version: Code 1.101.0 (dfaf44141ea9deb3b4096f7cd6d24e00c147a4b1, 2025-06-11T15:00:50.123Z)
OS version: Windows_NT x64 10.0.26100
Modes:
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2
- Python version (& distribution if applicable, e.g. Anaconda): 3.12.11
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Pixi
- Value of the
python.languageServersetting: Pylance
User Settings
Multiroot scenario, following user settings may not apply:
languageServer: "Pylance"
testing
• cwd: "<placeholder>"
• promptToConfigure: false
• pytestArgs: "<placeholder>"
• pytestEnabled: true
• pytestPath: "<placeholder>"
experiments
• optInto: ["pythonTestAdapter"]
• optOutFrom: ["pythonTerminalEnvVarActivation"]
Installed Extensions
| Extension Name | Extension Id | Version |
|---|---|---|
| azure-pipelines | ms- | 1.249.0 |
| copilot | Git | 1.335.0 |
| copilot-chat | Git | 0.28.0 |
| datawrangler | ms- | 1.22.0 |
| debugpy | ms- | 2025.8.0 |
| docker | doc | 0.10.0 |
| dotenv-vscode | dot | 0.28.1 |
| even-better-toml | tam | 0.21.2 |
| gitlens | eam | 17.2.0 |
| indent-rainbow | ode | 8.3.1 |
| js-debug | ms- | 1.100.1 |
| jupyter | ms- | 2025.5.0 |
| jupyter-renderers | ms- | 1.1.0 |
| markdown-all-in-one | yzh | 3.6.3 |
| markdown-preview-enhanced | shd | 0.8.18 |
| python | ms- | 2025.8.0 |
| resourcemonitor | mut | 1.0.7 |
| ruff | cha | 2025.24.0 |
| RunOnSave | eme | 0.2.7 |
| shellcheck | tim | 0.37.7 |
| tasks | act | 0.16.1 |
| vscode-ai | ms- | 1.2.0 |
| vscode-ai-remote | ms- | 1.4.2 |
| vscode-auto-open-workspace | zom | 0.0.4 |
| vscode-azureresourcegroups | ms- | 0.10.13 |
| vscode-containers | ms- | 2.0.3 |
| vscode-docker | ms- | 2.0.0 |
| vscode-js-profile-table | ms- | 1.0.10 |
| vscode-jupyter-cell-tags | ms- | 0.1.9 |
| vscode-jupyter-slideshow | ms- | 0.1.6 |
| vscode-marimo | mar | 0.6.5 |
| vscode-markdownlint | Dav | 0.60.0 |
| vscode-pylance | ms- | 2025.6.1 |
| vscode-yaml | red | 1.18.0 |
| workspace-terminals | jos | 0.3.4 |
System Info
| Item | Value |
|---|---|
| CPUs | 13th Gen Intel(R) Core(TM) i7-13850HX (28 x 2304) |
| 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) | 31.66GB (9.34GB free) |
| Process Argv | --crash-reporter-id bc453f47-6475-4dca-884b-395c4b2f80af |
| Screen Reader | no |
| VM | 0% |
| Item | Value |
|---|---|
| Remote | WSL: Ubuntu-24.04 |
| OS | Linux x64 6.6.87.2-microsoft-standard-WSL2 |
| CPUs | 13th Gen Intel(R) Core(TM) i7-13850HX (28 x 0) |
| Memory (System) | 15.45GB (12.42GB free) |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vscaat:30438848
c4g48928:30535728
azure-dev_surveyonecf:30548226
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
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
c7cif404:31314491
pythonpulldiagcf:31325931
996jf627:31283433
pythonrdcb7:31303018
usemplatestapi:31297334
0aa6g176:31307128
7bj51361:31289155
747dc170:31275177
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
he899328:31327032
useunpkg:31331645
1292j425:31329156
id45c886:31329544

Activity
anthonykim1 commentedon Jun 23, 2025
Hello Raphaël Melançon (@RaphaelMelanconAtBentley) Thanks for filing the issue.
Does it get any better if you:
to your settings.json?
RaphaelMelanconAtBentley commentedon Jun 25, 2025
Nope, I get the exact same behavior as without it.
RaphaelMelanconAtBentley commentedon Jun 25, 2025
I'm on WSL, but I have multiple colleagues with the same issue on MacOS.
RaphaelMelanconAtBentley commentedon Jun 25, 2025
Here is a minimal repository that can reproduce this issue: https://github.com/RaphaelMelanconAtBentley/vscode-python-environment-activation-issue
irm-codebase commentedon Jun 30, 2025
I am likely seeing this same problem on Fedora 42.
See here: microsoft/vscode-python-debugger#741
RaphaelMelanconAtBentley commentedon Jul 11, 2025
Any update on this issue Anthony Kim (@anthonykim1) ? This is limiting our entire development team at the moment...
ignition5 commentedon Jul 16, 2025
I have the same problem, the solution wanted!!!
renan-r-santos commentedon Jul 16, 2025
This is also happening to me, but in a Linux devcontainer running on macOS. A few things I noticed:
sleep 0.2to my zsh init script.pythonTerminalEnvVarActivationexperiment, but it gets deactivated because I'm in a multi-root workspace.launch.jsonas a single-root workspace, thenpythonTerminalEnvVarActivationgets activated, and debugging the Pixi environments works just fine, even with asleep 5in my shell init script. It works on both Mac M4 and M1.Could this be related to #24589 (comment), particularly the timeout set here?
If this is helpful and you'd like more info about my environment, please let me know.
12 remaining items
anthonykim1 commentedon Jan 8, 2026
I think this printEnvVariables.py were being used for the old pythonTerminalEnvVarActivation
For things like starship prompt please try out the new shellStartup way:
Try install https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-python-envs , and download the latest-pre-release.
Please set
python-envs.terminal.autoActivationTypetoshellStartupin your settings.Also add
"python.useEnvironmentsExtension": true,to your settings.json.Jaapel commentedon Jan 28, 2026
Went back to this issue again. This
python-envs.terminal.autoActivationTypesetting is grayed out and does not change behaviour.anthonykim1 commentedon Jan 28, 2026
Jaap Langemeijer (@Jaapel) Check if higher scope is overriding it, such as workspace setting overriding user settings, etc
Do you have environment extension enabled and installed?
Jaapel commentedon Jan 29, 2026
Yes I have the environment extension enabled!
For now I got it working by removing the environment extension.
irm-codebase commentedon Feb 4, 2026
Anthony Kim (@anthonykim1) any hope of this getting fixed?
it's making debugging
pixiprojects very difficult on our endirm-codebase commentedon Feb 4, 2026
I can provide additional context if necessary. Anything to get this done.
hadim commentedon Feb 19, 2026
I'm experiencing the same root cause but affecting Jupyter kernel startup (not the debugger). Every kernel start/restart is delayed by exactly 30s due to the Failed to get activated env vars timeout with Pixi environments.
I've opened a dedicated issue for this case: #25804
anthonykim1 commentedon Mar 13, 2026
The terminal activation interfering with debugger launch is likely caused by the legacy command-based activation mechanism, which sends activation commands into the terminal's command stream.
Please try migrating to the Python Environments extension's
shellStartupactivation, which injects activation into your shell profile instead — keeping the command stream clean for the debugger:python-envs.terminal.autoActivationTypetoshellStartupin your settings"python.useEnvironmentsExtension": trueto your settings.jsonSee more details here: https://code.visualstudio.com/updates/v1_106#_consolidated-shell-integration-timeout-setting
Also see #25291 for the full migration guide. Please let us know if this resolves the issue!
RaphaelMelanconAtBentley commentedon Mar 18, 2026
I wish I could migrate to using the new extension, but it does not seem to work well with multi-root workspaces yet. I have create an issue about this with a reproduction example, but have had no response to it: microsoft/vscode-python-environments#1107
lukaslcf commentedon Apr 9, 2026
Still have the same issue even using
shellStartupoption. I am using remote environment if that gives extra context to the problem.github-actions commentedon May 10, 2026
Hey Anthony Kim (@anthonykim1), this issue might need further attention.
Raphaël Melançon (@RaphaelMelanconAtBentley), you can help us out by closing this issue if the problem no longer exists, or adding more information.
github-actions commentedon Jun 9, 2026
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!