Skip to content

[Python Environments] Virtual environment activation is slow #997

@cecheta

Description

@cecheta

Type: Performance Issue

Activating the virtual environment seems to take a long time (about 5 seconds) after opening a new shell. This is quite annoying, as the source command that gets executed in the shell will interrupt any other command that you are currently trying to write.

Image

Environment Information
Extension Version: 1.12.0
Python Extension Version: 2025.18.0

Registered Environment Managers (4):
  - ms-python.python:system (Global)
  - ms-python.python:venv (venv)
  - ms-python.python:pyenv (PyEnv)
  - ms-python.python:poetry (Poetry)

Total Available Environments: 6
Environment Details:
  1. Python 3.13.9 (homebrew) (3.13.9.final.0) - /home/linuxbrew/.linuxbrew/bin/python3.13
  2. Python 3.12.3 (3.12.3.final.0) - /bin/python3
  3. Python 3.12.3 (3.12.3.final.0) - /usr/bin/python3
  4. .venv (3.13.9) (3.13.9) - /home/cecheta/Code/playground/.venv/bin/python
  5. pyenv (3.13.9) (3.13.9) - /home/cecheta/.pyenv/versions/3.13.9
  6. pyenv (3.12.9) (3.12.9) - /home/cecheta/.pyenv/versions/3.12.9

Python Projects (1):
  1. /home/cecheta/Code/playground
     Environment: .venv (3.13.9)

Extension Settings:
  Default Environment Manager: ms-python.python:venv
  Default Package Manager: ms-python.python:pip
Auto-activation is "command". Activation based on first 'py-env.terminal.autoActivationType' setting which is 'command' and 'python.terminal.activateEnvironment' if the first is undefined which is 'true'.

Extension version: 1.12.0
VS Code version: Code 1.106.2 (1e3c50d64110be466c0b4a45222e81d2c9352888, 2025-11-19T16:56:50.023Z)
OS version: Windows_NT x64 10.0.26200
Modes:
Connection to 'dev-container+7b22686f737450617468223a225c5c5c5c77736c2e6c6f63616c686f73745c5c5562756e74755c5c686f6d655c5c636563686574615c5c436f64655c5c706c617967726f756e645c5c7265636f6d6d656e6465722d617263686974656374757265222c226c6f63616c446f636b6572223a66616c73652c22636f6e66696746696c65223a7b22246d6964223a312c2270617468223a222f686f6d652f636563686574612f436f64652f706c617967726f756e642f7265636f6d6d656e6465722d6172636869746563747572652f2e646576636f6e7461696e65722f646576636f6e7461696e65722e6a736f6e222c22736368656d65223a227673636f64652d66696c65486f7374227d7d' could not be established
Remote OS version: Linux x64 5.15.167.4-microsoft-standard-WSL2

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-1265U (12 x 2688)
GPU Status 2d_canvas: enabled
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: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.83GB (7.15GB free)
Process Argv --crash-reporter-id 392977bc-6401-4ec2-bcbf-cace57dee1d0
Screen Reader no
VM 0%

Connection to 'dev-container+7b22686f737450617468223a225c5c5c5c77736c2e6c6f63616c686f73745c5c5562756e74755c5c686f6d655c5c636563686574615c5c436f64655c5c706c617967726f756e645c5c7265636f6d6d656e6465722d617263686974656374757265222c226c6f63616c446f636b6572223a66616c73652c22636f6e66696746696c65223a7b22246d6964223a312c2270617468223a222f686f6d652f636563686574612f436f64652f706c617967726f756e642f7265636f6d6d656e6465722d6172636869746563747572652f2e646576636f6e7461696e65722f646576636f6e7461696e65722e6a736f6e222c22736368656d65223a227673636f64652d66696c65486f7374227d7d' could not be established

Item Value
Remote WSL: Ubuntu
OS Linux x64 5.15.167.4-microsoft-standard-WSL2
CPUs 12th Gen Intel(R) Core(TM) i7-1265U (12 x 0)
Memory (System) 15.54GB (10.68GB free)
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    0	   179	 16676	code
    0	   126	  2560	file-watcher [8]
    0	   278	  5348	window [1] (.env - recommender-architecture [Dev Container: Recs-explore] - Visual Studio Code)
    0	    32	  5704	   crashpad-handler
    0	   238	  9424	shared-process
    0	   223	 15044	   gpu-process
    0	   245	 15888	extension-host [8]
    0	    10	 11760	     C:\WINDOWS\system32\wsl.exe -d ubuntu -e /bin/sh -c "cd '/home/cecheta/Code/playground' && /bin/sh"
    0	     9	 19812	       C:\WINDOWS\system32\conhost.exe 0x4
    0	    15	 28420	       C:\WINDOWS\system32\wsl.exe -d ubuntu -e /bin/sh -c "cd '/home/cecheta/Code/playground' && /bin/sh"
    0	    14	 24632	          --distro-id {138b298a-6910-4cd5-8bdc-e4d0710d0a4b} --vm-id {d0ee5567-ee97-41d5-b507-cc3939d15410} --handle 940 --event 976 --parent 980
    0	    12	 33624	           C:\WINDOWS\system32\conhost.exe 0x4
    0	   110	 29184	     electron-nodejs (wslDaemon.js )
    2	   374	 16240	window [8] (● <!-- Please describe the issue you're ex • Untitled-1 - playground [WSL: Ubuntu] - Visual Studio Code)
    0	    98	 20236	file-watcher [1]
    0	    53	 22784	   utility-network-service
    0	   128	 23620	pty-host
    0	   211	 28788	extension-host [1]
    0	    99	 14488	     "C:\Users\cecheta\AppData\Local\Programs\Microsoft VS Code\Code.exe" c:\Users\cecheta\.vscode\extensions\ms-vscode-remote.remote-containers-0.431.1\dist\shutdown\shutdownMonitorProcess \\.\pipe\vscode-remote-containers-034f4264-7efc-4371-8bda-0757af2bcc37-sock singleContainer Debug c:\Users\cecheta\AppData\Roaming\Code\logs\20251120T101323\window1\exthost\ms-vscode-remote.remote-containers 1763633612201
    0	    10	 33304	     C:\WINDOWS\system32\wsl.exe -d Ubuntu -e /bin/sh -c "cd '/home/cecheta/Code/playground/recommender-architecture' && /bin/sh"
    0	    15	 26740	       C:\WINDOWS\system32\wsl.exe -d Ubuntu -e /bin/sh -c "cd '/home/cecheta/Code/playground/recommender-architecture' && /bin/sh"
    0	    14	  5780	          --distro-id {138b298a-6910-4cd5-8bdc-e4d0710d0a4b} --vm-id {d0ee5567-ee97-41d5-b507-cc3939d15410} --handle 928 --event 960 --parent 964
    0	    12	 33200	           C:\WINDOWS\system32\conhost.exe 0x4
    0	     9	 30432	       C:\WINDOWS\system32\conhost.exe 0x4
Connection to 'dev-container+7b22686f737450617468223a225c5c5c5c77736c2e6c6f63616c686f73745c5c5562756e74755c5c686f6d655c5c636563686574615c5c436f64655c5c706c617967726f756e645c5c7265636f6d6d656e6465722d617263686974656374757265222c226c6f63616c446f636b6572223a66616c73652c22636f6e66696746696c65223a7b22246d6964223a312c2270617468223a222f686f6d652f636563686574612f436f64652f706c617967726f756e642f7265636f6d6d656e6465722d6172636869746563747572652f2e646576636f6e7461696e65722f646576636f6e7461696e65722e6a736f6e222c22736368656d65223a227673636f64652d66696c65486f7374227d7d' could not be established
Connection to 'WSL: Ubuntu' could not be established  cat: /proc/23154/stat: No such file or directory
/home/cecheta/.vscode-server/bin/1e3c50d64110be466c0b4a45222e81d2c9352888/out/vs/base/node/cpuUsage.sh: line 27: let: PROCESS_TIME_BEFORE=+: syntax error: operand expected (error token is "+")

Workspace Info

Connection to 'dev-container+7b22686f737450617468223a225c5c5c5c77736c2e6c6f63616c686f73745c5c5562756e74755c5c686f6d655c5c636563686574615c5c436f64655c5c706c617967726f756e645c5c7265636f6d6d656e6465722d617263686974656374757265222c226c6f63616c446f636b6572223a66616c73652c22636f6e66696746696c65223a7b22246d6964223a312c2270617468223a222f686f6d652f636563686574612f436f64652f706c617967726f756e642f7265636f6d6d656e6465722d6172636869746563747572652f2e646576636f6e7461696e65722f646576636f6e7461696e65722e6a736f6e222c22736368656d65223a227673636f64652d66696c65486f7374227d7d' could not be established
Connection to 'WSL: Ubuntu' could not be established  cat: /proc/23154/stat: No such file or directory
/home/cecheta/.vscode-server/bin/1e3c50d64110be466c0b4a45222e81d2c9352888/out/vs/base/node/cpuUsage.sh: line 27: let: PROCESS_TIME_BEFORE=+: syntax error: operand expected (error token is "+")
;
A/B Experiments
vsliv368cf:30146710
vswsl492:30256859
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
aj953862:31281341
nes-set-on:31351930
63221493:31336333
envsactivate1:31353494
aa_t:31379598
t123456:31413567
0574c672:31404437
asdad-cf:31397862
cloudbuttont:31379625
todos-1:31405332
v66_all_req:31402695
treatment_gpt5applypatchexclusively:31412086
3efgi100_wstrepl:31403338
trigger-command-fix:31379601
auto_model_enabled:31396818
use-responses-api:31390855
sonnet_45_3e700918:31419541
je187915:31401257
v2prompt_9f72f763:31415580
afag3459:31419926
ec5jj548:31422691
copilot-nes-oct-t:31418199
metis_rerank_treatment1:31422731
ff8f5884:31411053
c0683394:31419495

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions