Skip to content

debugpy cli does not work when using virtual envs #606

Closed
@karthiknadig

Description

@karthiknadig

Type: Bug

Behaviour

Activate a virutal environment in VS Code terminal. Try debugging using the activated python. It uses the wrong python.

Steps to reproduce:

  1. This in on Windows
  2. Have multiple pythons installed using windows store
  3. Create a virtual environment
  4. Load a python project and use cli debugging.
  5. If you print sys.executable you get the wrong one.

Diagnostic data

launch.json configuration

XXX

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

Output for Python Debugger in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python Debugger)

XXX

Extension version: 2025.1.2025021101
VS Code version: Code - Insiders 1.98.0-insider (b1bce46d27c96db4ad9e1a7968606118feff9abb, 2025-02-11T12:59:07.299Z)
OS version: Windows_NT x64 10.0.26100
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.8
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): VirtualEnvironment
System Info
Item Value
CPUs Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz (8 x 1498)
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.60GB (10.67GB free)
Process Argv --log trace --log ms-python.python=info --crash-reporter-id 4fb1ebc1-cf4c-4880-a88a-47738ec3768d
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vsc_aacf:30263846
pythonvspyt551:31179976
vscod805cf:30301675
py29gd2263:31024238
14376chatcontrol:31235589
c4g48928:30535728
vscrpc:30624061
a9j8j154:30646983
962ge761:30841072
dsvsc014:30777825
dsvsc015:30821418
h48ei257:31000450
pythontbext0:30879054
cppperfnew:30980852
pythonait:30973460
dwnewjupytercf:31046870
nativerepl1:31134653
pythonrstrctxt:31093868
nativeloc1:31118317
e80f6927:31120813
iacca1:31150324
notype1:31143044
dwcopilot:31158714
h409b430:31177054
5b1c1929:31184661
bajee813:31235726
6074i472:31201624
dwoutputs:31233690
hdaa2157:31222309
copilot_t_ci:31222730
f27dg485:31233432
g012b348:31231168
jda6j935:31233686

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugimportantIssue identified as high-priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions