microsoft / microsoft/vscode-python-environments

[Python Environments] automatic activation of a wrong venv on spawning new terminal

Open
#1,467 2 comments 3 reactions 1 assignee Claimed by @anthonykim1 View on GitHub
Dominant language
TypeScript
Stars
138
Forks
62
Avg merge
1d 4h
Merged PRs (30d)
35

Description

Type: Bug

## Description
As I work with multiple Python virtual environments, I started to systematically observe, lately, automatic activation of Python executable from another venv than that of a directory currently opened in VS Code. It doesn't help even to add a local `./.vscode/settings.json` with `"python.defaultInterpreterPath"` setting (see below) in each project directory: the setting seems to be ignored.

## Steps to Reproduce
1. Open a directory in VS Code
2. Spawn Terminal > New

## Expected Behavior
No venv is activated or the right venv is activated.

## Actual Behavior
A wrong venv is activated.

Addendum: Workspace Settings (my-proj/.vscode/settings.json)

```json
{
"python.defaultInterpreterPath": "~/AppData/Local/pypoetry/Cache/virtualenvs/my-env-Jf--Zmr2-py3.10/Scripts/python.exe",
"python-envs.defaultEnvManager": "ms-python.python:poetry",
"python-envs.defaultPackageManager": "ms-python.python:poetry",
}
```

Environment Information

```
Extension Version: 1.28.0
Python Extension Version: 2026.4.0

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

Total Available Environments: 4
Environment Details:
1. Python 3.10 (64-bit) (3.10.11) - C:\Program Files\Python 3.10.11\python.exe
2. poetry (3.10.11) (3.10.11.final.0) - C:\Users\kisakov\AppData\Local\pypoetry\Cache\virtualenvs\dfc-algo-non-fleche-ta-XDwmDIVE-py3.10
3. poetry (3.10.11) (3.10.11.final.0) - C:\Users\kisakov\AppData\Local\pypoetry\Cache\virtualenvs\dfc-installation-poste-nouvel-arrivant-gvd-Jf--Zmr2-py3.10
4. poetry (3.10.11) (3.10.11.final.0) - C:\Users\kisakov\AppData\Local\pypoetry\Cache\virtualenvs\dfc-predict-fraude-of-j_gWKM4I-py3.10

Python Projects (1):
1. c:\DEVELOPPEMENT\dfc-installation-poste-nouvel-arrivant-gvd
Environment: poetry (3.10.11)

Extension Settings:
Default Environment Manager: ms-python.python:poetry
Default Package Manager: ms-python.python:poetry
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.28.0
VS Code version: Code 1.116.0 (560a9dba96f961efea7b1612916f89e5d5d4d679, 2026-04-15T00:28:13Z)
OS version: Windows_NT x64 10.0.26100
Modes:

System Info

|Item|Value|
|---|---|
|CPUs|12th Gen Intel(R) Core(TM) i5-1240P (16 x 2112)|
|GPU Status|2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x46a6 [Intel(R) Iris(R) Xe Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=32.0.101.5763 *ACTIVE*
GPU1: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.7309
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: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|31.65GB (17.49GB free)|
|Process Argv|C:\\DEVELOPPEMENT\\dfc-installation-poste-nouvel-arrivant-gvd --crash-reporter-id 54d17900-a134-43ae-be6d-3f8adf52dd4b|
|Screen Reader|no|
|VM|0%|

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
envsactivate1:31464700
cloudbuttont:31379625
3efgi100_wstrepl:31403338
55ia6109:31457054
use-responses-api:31390855
ddidt:31399633
ec5jj548:31422691
cp_cls_c_966_ss:31454199
4je02754:31466945
8hhj4413:31478653
cp_cls_c_1081:31454833
conptydll_false:31489735
e9c30283:31461165
test_treatment2:31471001
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
534a6447:31496642
chat:31457767
quick_suggest_off_75197330:31497037
cpptoolsoff-v2:31475362
ghj88844:31492074
23c7c724:31491644
client_tst_t:31495907
ddid_t:31478206
getcmakediagnosticson:31489824
cp_cls_c_1082:31491634
logging_disabled_new:31493366
output_1x:31496637
56dj4588:31497896

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.