Type: Bug
Summary
When opening a terminal in VS Code with Python extension enabled, the virtual environment activation:
- Happens with a delay (a few seconds)
- Sometimes runs twice
- Interrupts user input if typing has already started
This makes the terminal unreliable and feels like a race condition.
Steps to Reproduce
- Open a workspace with a .venv
- Ensure Python interpreter is set to that venv
- Open a new terminal
- Immediately start typing
Expected Behavior
- Environment activates immediately OR deterministically before input
- Activation runs exactly once
- No interruption of user input
Actual Behavior
- Activation occurs after a delay
- Sometimes runs twice
- Interrupts typing (inserts activation command mid-input)
Settings
Example settings:
{
"python-envs.terminal.autoActivationType": "command",
"python.terminal.activateEnvInCurrentTerminal": true
}
(Also observed with default settings)
Environment
- VS Code version:
- Python extension version:
- OS: (Linux / Windows / macOS)
- Shell: (bash, zsh, etc.)
Additional Notes
This appears related to multiple activation mechanisms:
- python-envs.terminal.autoActivationType
- python.terminal.activateEnvironment
- python.terminal.activateEnvInCurrentTerminal
Possibly a race condition between extension activation and terminal creation.
PYTHON SHOW OUTPUT:
2026-03-17 19:43:38.307 [info] Native locator: Refresh started
2026-03-17 19:43:38.555 [info] Native locator: Refresh started
2026-03-17 19:43:38.763 [info] VS Code was launched from an activated environment: 'venv', selecting it as the interpreter for workspace.
2026-03-17 19:43:38.800 [info] Native locator: Refresh finished in 596 ms
2026-03-17 19:43:39.180 [info] Native locator: Refresh started
2026-03-17 19:43:39.182 [info] Python interpreter path: ./venv/bin/python
2026-03-17 19:43:39.205 [info] Active interpreter [/home/saspeh/today/2026-03-17/cword]: /home/saspeh/today/2026-03-17/cword/venv/bin/python
2026-03-17 19:43:39.765 [info] Native locator: Refresh finished in 585 ms
2026-03-17 19:43:39.799 [info] > pyenv which python
2026-03-17 19:43:39.799 [info] cwd: .
2026-03-17 19:43:41.998 [info] Starting Pylance language server.
2026-03-17 19:45:50.797 [info] Native locator: Refresh started
2026-03-17 19:45:50.851 [info] Native locator: Refresh finished in 495 ms
2026-03-17 19:45:50.852 [info] VS Code was launched from an activated environment: 'venv', selecting it as the interpreter for workspace.
2026-03-17 19:45:51.018 [info] Python interpreter path: ./venv/bin/python
2026-03-17 19:45:51.296 [info] > pyenv which python
2026-03-17 19:45:51.296 [info] cwd: .
2026-03-17 19:45:53.515 [info] Starting Pylance language server.
My thoughts
This feels like a race condition between terminal startup and extension activation.
Extension version: 2026.4.0
VS Code version: Code 1.111.0 (ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb, 2026-03-06T23:06:10Z)
OS version: Linux x64 6.8.0-106-generic
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.12.3
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
- Value of the
python.languageServer setting: Default
User Settings
languageServer: "Pylance"
Installed Extensions
| Extension Name |
Extension Id |
Version |
| autodocstring |
njp |
0.6.1 |
| autopep8 |
ms- |
2025.2.0 |
| black-formatter |
ms- |
2025.2.0 |
| cmake |
twx |
0.0.17 |
| cmake-tools |
ms- |
1.22.28 |
| copilot-chat |
Git |
0.39.2 |
| cpp-devtools |
ms- |
0.3.6 |
| cpptools |
ms- |
1.30.5 |
| cpptools-extension-pack |
ms- |
1.5.1 |
| cpptools-themes |
ms- |
2.0.0 |
| debugpy |
ms- |
2025.18.0 |
| docker |
doc |
0.18.0 |
| even-better-toml |
tam |
0.21.2 |
| go |
gol |
0.52.2 |
| java |
red |
1.53.0 |
| jinja |
who |
0.0.8 |
| js-debug |
ms- |
1.110.0 |
| js-debug-companion |
ms- |
1.1.3 |
| language-j |
tik |
0.9.6 |
| live-server |
ms- |
0.4.17 |
| LiveServer |
rit |
5.7.10 |
| open-in-vim |
jon |
0.7.0 |
| pdf |
tom |
1.2.2 |
| python |
ms- |
2026.4.0 |
| python-docs |
Muk |
0.8.3 |
| python-environment-manager |
don |
1.2.7 |
| python-extension-pack |
don |
1.7.0 |
| rainbow-csv |
mec |
3.24.1 |
| remote-containers |
ms- |
0.447.0 |
| scala |
sca |
0.5.9 |
| sqlite-viewer |
qwt |
25.12.2 |
| test-adapter-converter |
ms- |
0.2.1 |
| todo-tree |
Gru |
0.0.226 |
| vsc-python-indent |
Kev |
1.21.0 |
| vscode-containers |
ms- |
2.4.1 |
| vscode-django |
bat |
1.15.0 |
| vscode-docker |
ms- |
2.0.0 |
| vscode-github-actions |
git |
0.31.0 |
| vscode-gradle |
vsc |
3.17.2 |
| vscode-java-debug |
vsc |
0.58.5 |
| vscode-java-dependency |
vsc |
0.27.0 |
| vscode-java-pack |
vsc |
0.30.5 |
| vscode-java-test |
vsc |
0.44.0 |
| vscode-js-profile-table |
ms- |
1.0.10 |
| vscode-maven |
vsc |
0.45.1 |
| vscode-pylance |
ms- |
2026.1.1 |
| vscode-python-envs |
ms- |
1.22.0 |
| vscode-python-test-adapter |
lit |
0.8.2 |
| vscode-sqlite |
ale |
0.14.1 |
| vscode-test-explorer |
hbe |
2.22.1 |
| vscode-xml |
red |
0.29.0 |
| vscode-yaml |
red |
1.21.0 |
System Info
| Item |
Value |
| CPUs |
AMD Ryzen 7 5700G with Radeon Graphics (16 x 3705) |
| GPU Status |
2d_canvas: enabled GPU0: VENDOR= 0x1002 [Google Inc. (AMD)], DEVICE=0x1638 [ANGLE (AMD, AMD Radeon Graphics (radeonsi renoir ACO), OpenGL 4.6 (Core Profile) Mesa 25.2.8-0ubuntu0.24.04.1)], DRIVER_VENDOR=Mesa, DRIVER_VERSION=25.2.8 ACTIVE Machine model name: Machine model version: 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 trees_in_viz: disabled_off video_decode: enabled video_encode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off webnn: disabled_off |
| Load (avg) |
0, 1, 1 |
| Memory (System) |
14.96GB (9.09GB free) |
| Process Argv |
. --crash-reporter-id 76f07ab8-e1ec-4776-ab4a-6235c73325cf |
| Screen Reader |
no |
| VM |
0% |
| DESKTOP_SESSION |
ubuntu |
| XDG_CURRENT_DESKTOP |
ubuntu:GNOME |
| XDG_SESSION_DESKTOP |
ubuntu |
| XDG_SESSION_TYPE |
x11 |
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
6abeh943:31336334
envsdeactivate2:31464701
cloudbuttont:31379625
aihoversummaries_f:31469309
3efgi100_wstrepl:31403338
56b7f661:31457055
use-responses-api:31390855
anonusage:31403420
ddidtcf:31399634
je187915:31401257
ec5jj548:31422691
cp_cls_t_966_ss:31454198
a9239246:31458807
4je02754:31466945
c3h7c220:31478652
ge8j1254_inline_auto_hint_haiku:31431912
38bie571_auto:31478678
7a04d226_do_not_restore_last_panel_session:31438103
preserve_tokens:31444547
cp_cls_t_1081:31454832
ia-use-proxy-models-svc:31452481
a43f0574a:31442826
e9c30283:31461165
test_treatment2:31471001
ts_provider_disabled:31458191
nes-conv-2-3:31477815
g_63ac8346:31467999
idci7584:31464702
edit_mode_hidden:31461530
864ei723_large_tool_results_to_disk:31460878
notips:31471632
ei9d7968:31458072
534a6447_copy:31478748
nes-extended-on:31455476
chat:31457767
8hig5102:31473806
ah:31460422
8a2c4887_5_3_codex_prompt:31475326
cpptoolson-v2:31475363
thinking_effort_h:31478170
4dgh1208:31471592
editor1:31474144
thinking_c:31471065
db0gd219:31473911
newsessionicon:31473927
h08i8180_copy:31475368
ddid_t:31478206
Type: Bug
Summary
When opening a terminal in VS Code with Python extension enabled, the virtual environment activation:
This makes the terminal unreliable and feels like a race condition.
Steps to Reproduce
Expected Behavior
Actual Behavior
Settings
Example settings:
{
"python-envs.terminal.autoActivationType": "command",
"python.terminal.activateEnvInCurrentTerminal": true
}
(Also observed with default settings)
Environment
Additional Notes
This appears related to multiple activation mechanisms:
Possibly a race condition between extension activation and terminal creation.
PYTHON SHOW OUTPUT:
2026-03-17 19:43:38.307 [info] Native locator: Refresh started
2026-03-17 19:43:38.555 [info] Native locator: Refresh started
2026-03-17 19:43:38.763 [info] VS Code was launched from an activated environment: 'venv', selecting it as the interpreter for workspace.
2026-03-17 19:43:38.800 [info] Native locator: Refresh finished in 596 ms
2026-03-17 19:43:39.180 [info] Native locator: Refresh started
2026-03-17 19:43:39.182 [info] Python interpreter path: ./venv/bin/python
2026-03-17 19:43:39.205 [info] Active interpreter [/home/saspeh/today/2026-03-17/cword]: /home/saspeh/today/2026-03-17/cword/venv/bin/python
2026-03-17 19:43:39.765 [info] Native locator: Refresh finished in 585 ms
2026-03-17 19:43:39.799 [info] > pyenv which python
2026-03-17 19:43:39.799 [info] cwd: .
2026-03-17 19:43:41.998 [info] Starting Pylance language server.
2026-03-17 19:45:50.797 [info] Native locator: Refresh started
2026-03-17 19:45:50.851 [info] Native locator: Refresh finished in 495 ms
2026-03-17 19:45:50.852 [info] VS Code was launched from an activated environment: 'venv', selecting it as the interpreter for workspace.
2026-03-17 19:45:51.018 [info] Python interpreter path: ./venv/bin/python
2026-03-17 19:45:51.296 [info] > pyenv which python
2026-03-17 19:45:51.296 [info] cwd: .
2026-03-17 19:45:53.515 [info] Starting Pylance language server.
My thoughts
This feels like a race condition between terminal startup and extension activation.
Extension version: 2026.4.0
VS Code version: Code 1.111.0 (ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb, 2026-03-06T23:06:10Z)
OS version: Linux x64 6.8.0-106-generic
Modes:
python.languageServersetting: DefaultUser Settings
Installed Extensions
System Info
GPU0: VENDOR= 0x1002 [Google Inc. (AMD)], DEVICE=0x1638 [ANGLE (AMD, AMD Radeon Graphics (radeonsi renoir ACO), OpenGL 4.6 (Core Profile) Mesa 25.2.8-0ubuntu0.24.04.1)], DRIVER_VENDOR=Mesa, DRIVER_VERSION=25.2.8 ACTIVE
Machine model name:
Machine model version:
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
trees_in_viz: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
A/B Experiments