Skip to content

Terminal does not activate virtual environment #24206

@ksylvan

Description

@ksylvan

Type: Bug

Behaviour

I have a new python project, with a .venv directory that is correctly picked up by the Python extension. The virtual environment is obviously used correctly when I edit the files, but when I start a terminal, the venv is not auto-loaded, even though python.terminal.activateEnvironment is true

image

Steps to reproduce:

  1. Load the directory in VSCode
  2. Start a VSCode Terminal
  3. Try to run the python script.
kayvan@dharma src/GroupRosterEmailer [main] $ ./group_roster.py 
Traceback (most recent call last):
  File "/Users/kayvan/src/GroupRosterEmailer/./group_roster.py", line 13, in <module>
    from dotenv import load_dotenv
ModuleNotFoundError: No module named 'dotenv'
kayvan@dharma src/GroupRosterEmailer [main] $ 

Diagnostic data

launch.json configuration

N/A

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

N/A

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

N/A

Extension version: 2024.15.2024092702
VS Code version: Code - Insiders 1.94.0-insider (1cbbe85eaad55215833e597d675e778db74ae80e, 2024-09-27T14:53:58.142Z)
OS version: Darwin arm64 23.6.0
Modes:

System Info
Item Value
CPUs Apple M3 Max (14 x 2400)
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
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 2, 2
Memory (System) 36.00GB (3.68GB free)
Process Argv --crash-reporter-id acd81060-c8be-4ec7-b16f-3b61186043f6
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
vsaa593cf:30376535
py29gd2263:31024238
c4g48928:30535728
962ge761:30841072
pythongtdpath:30726887
welcomedialog:30812478
pythonnoceb:30776497
asynctok:30898717
dsvsc014:30777825
dsvsc015:30821418
pythonmypyd1:30859725
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30870582
dsvsc016:30879898
dsvsc017:30880771
dsvsc018:30880772
cppperfnew:30980852
pythonait:30973460
9c06g630:31013171
a69g1124:31018687
dvdeprecation:31040973
dwnewjupytercf:31046870
nb_pkg_only:31057982
nativerepl1:31134653
refactort:31084545
pythonrstrctxt:31093868
flighttreat:31119334
wkspc-onlycs-t:31132770
nativeloc1:31118317
wkspc-ranged-t:31125599
cf971741:31144450
e80f6927:31120813
defaultse:31146405
12bdf347:31141542
iacca2:31144504
notype1:31143044
c9j82188:31138334
showbadge:31139796
f8igb616:31140137

Metadata

Metadata

Assignees

Labels

triage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions