Skip to content

Problem with Python interpreter selection #25844

@llasherme

Description

@llasherme

Type: Bug

Behaviour

Before

I used to manage all my Python setup and projects with uv. When I needed to create a new Python project, I did it like so:
uv initcode <my-project> → Select Python Interpreter (bottom-right button in the UI) → Browse → .venv\Scripts\python.exe.

VSCode would then switch to my Python context and everything worked correctly.

Now

Same steps, but VSCode refuses to use the interpreter from the venv:
Unable to handle c:\Users\<my-path>\.venv\Scripts\python.exe (Source: Python Environments)

What I tried ?

  • Uninstalled the Python Environments extension → same issue
  • Re-installed it and tweaked multiple settings: python.defaultInterpreterPath, python.createEnvironment.trigger, etc. → same issue
  • Used the global Python interpreter → same issue
  • Installed pyenv (apparently used for Python version detection) → same issue
  • Changed the Python version → same issue
  • Tried the preview version of the extension → same issue

Steps to reproduce:

  1. OS: Windows 11 Professionnel
  2. VSCode: installed via scoop.sh — version 1.108.2 (extras 2026-01-26)
  3. Python manager: uv by Astral — versions: cpython-3.13.1, cpython-3.14.2 (windows-x86_64)
  4. Init a Python project with uv init, then open it in VSCode
  5. Click Select Python Interpreter → Browse (or manually enter the path): .venv\Scripts\python.exe
    (also reproduced with the global install at C:\Users\[USERNAME]\.local\bin\python.exe)

Diagnostic data

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

2026-03-10 14:32:59.694 [info] [test-by-project] Activating project-based testing mode
2026-03-10 14:32:59.695 [info] [test-by-project] Discovering projects for workspace: c:\Users\[USERNAME]\Documents\workspace\01-[COMPANY]\06-formation\anthropic\introduction-to-model-context-protocol\cli_project
2026-03-10 14:32:59.695 [info] Native locator: Refresh started
2026-03-10 14:32:59.695 [info] [test-by-project] Found 1 total Python projects from API
2026-03-10 14:32:59.695 [info] [test-by-project] Filtered to 1 projects in workspace
2026-03-10 14:32:59.695 [info] [test-by-project] Creating adapter for: cli_project at file:///c%3A/Users/[USERNAME]/Documents/workspace/01-[COMPANY]/06-formation/anthropic/introduction-to-model-context-protocol/cli_project
2026-03-10 14:32:59.781 [info] > pyenv which python
2026-03-10 14:32:59.781 [info] cwd: .
2026-03-10 14:33:40.423 [info] Skipping ActivatedEnv Detection:  process.env.VSCODE_CLI !== '1'
2026-03-10 14:33:40.428 [info] > pyenv which python
2026-03-10 14:33:40.428 [info] cwd: .
2026-03-10 14:34:30.431 [error] Autoselection timeout out, this is likely a issue with how consumer called execution factory API. Using default python to execute.
2026-03-10 14:34:30.455 [info] > python -c "import sys;print(sys.executable)"
2026-03-10 14:34:36.668 [error] [test-by-project] Failed to create adapter for c:\Users\[USERNAME]\Documents\workspace\01-[COMPANY]\06-formation\anthropic\introduction-to-model-context-protocol\cli_project: [Error: Python Environment Tools (PET) failed after 3 restart attempts. Please reload the window or check the output channel for details. To debug, run "Python Environments: Run Python Environment Tool (PET) in Terminal" from the Command Palette.
	at S.ensureProcessRunning (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:535872)
	at S.doRefresh (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:540575)
	at c.workerFunc (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:535168)
	at o.workFunc (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:287619)
	at o.start (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:286434)]
2026-03-10 14:34:36.668 [info] [test-by-project] All adapters failed, falling back to default project
2026-03-10 14:34:36.668 [info] [test-by-project] Creating default project for: c:\Users\[USERNAME]\Documents\workspace\01-[COMPANY]\06-formation\anthropic\introduction-to-model-context-protocol\cli_project
2026-03-10 14:34:36.669 [info] Native locator: Refresh finished in 96973 ms
2026-03-10 14:34:36.670 [error] [
  'Failed to activate a workspace, Class name = v, completed in 96975ms, has a falsy return value, Arg 1: <Uri:c:\\Users\\[USERNAME]\\Documents\\workspace\\01-[COMPANY]\\06-formation\\anthropic\\introduction-to-model-context-protocol\\cli_project\\mcp_client.py>, Arg 2: {"started":1773149579428}, Return Value: undefined',
  [Error: Python Environment Tools (PET) failed after 3 restart attempts. Please reload the window or check the output channel for details. To debug, run "Python Environments: Run Python Environment Tool (PET) in Terminal" from the Command Palette.
  	at S.ensureProcessRunning (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:535872)
  	at S.doRefresh (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:540575)
  	at c.workerFunc (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:535168)
  	at o.workFunc (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:287619)
  	at o.start (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:286434)]
]
2026-03-10 14:34:36.670 [error] Failure during activation. [Error: Python Environment Tools (PET) failed after 3 restart attempts. Please reload the window or check the output channel for details. To debug, run "Python Environments: Run Python Environment Tool (PET) in Terminal" from the Command Palette.
	at S.ensureProcessRunning (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:535872)
	at S.doRefresh (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:540575)
	at c.workerFunc (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:535168)
	at o.workFunc (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:287619)
	at o.start (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:286434)]
2026-03-10 14:34:36.670 [error] sendStartupTelemetry() failed. [Error: Python Environment Tools (PET) failed after 3 restart attempts. Please reload the window or check the output channel for details. To debug, run "Python Environments: Run Python Environment Tool (PET) in Terminal" from the Command Palette.
	at S.ensureProcessRunning (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:535872)
	at S.doRefresh (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:540575)
	at c.workerFunc (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:535168)
	at o.workFunc (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:287619)
	at o.start (C:\Users\[USERNAME]\scoop\persist\vscode\data\extensions\ms-python.vscode-python-envs-1.20.1-win32-x64\dist\extension.js:2:286434)]
2026-03-10 14:34:36.671 [info] [test-by-project] Registered 1 project(s) for c:\Users\[USERNAME]\Documents\workspace\01-[COMPANY]\06-formation\anthropic\introduction-to-model-context-protocol\cli_project
2026-03-10 14:34:36.673 [info] [test-by-project] Activated 1 project(s) for c:\Users\[USERNAME]\Documents\workspace\01-[COMPANY]\06-formation\anthropic\introduction-to-model-context-protocol\cli_project
2026-03-10 14:34:36.675 [info] [test-by-project] Subscribed to Python project changes
2026-03-10 14:34:42.417 [error] Autoselection timeout out, this is likely a issue with how consumer called execution factory API. Using default python to execute.
2026-03-10 14:34:49.083 [error] Autoselection timeout out, this is likely a issue with how consumer called execution factory API. Using default python to execute.
2026-03-10 14:34:58.794 [error] Autoselection timeout out, this is likely a issue with how consumer called execution factory API. Using default python to execute.
2026-03-10 14:35:04.697 [error] Autoselection timeout out, this is likely a issue with how consumer called execution factory API. Using default python to execute.
2026-03-10 14:35:07.998 [error] Autoselection timeout out, this is likely a issue with how consumer called execution factory API. Using default python to execute.
2026-03-10 14:36:33.081 [info] Active interpreter [global]:  ./.venv/Scripts/python.exe
2026-03-10 14:36:33.090 [info] > ./.venv/Scripts/python.exe -c "import sys;print(sys.executable)"
2026-03-10 14:36:33.409 [error] Unable to find workspace for given file
2026-03-10 14:36:34.747 [error] Unable to find workspace for given file

Extension version: 2026.2.0
VS Code version: Code 1.108.2 (c9d77990917f3102ada88be140d28b038d1dd7c7, 2026-01-21T13:52:09.270Z)
OS version: Windows_NT x64 10.0.26200
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda):
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Unknown
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
debugpy ms- 2025.18.0
gitlens eam 17.11.0
js-debug ms- 1.105.0
js-debug-companion ms- 1.1.3
material-icon-theme PKi 5.32.0
python ms- 2026.2.0
terraform has 2.39.0
vscode-containers ms- 2.4.1
vscode-docker ms- 2.0.0
vscode-js-profile-table ms- 1.0.10
vscode-pylance ms- 2026.1.1
vscode-python-envs ms- 1.20.1
System Info
Item Value
CPUs Intel(R) Core(TM) Ultra 5 235U (14 x 3187)
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
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.46GB (3.64GB free)
Process Argv --crash-reporter-id 586dcc4e-3f5a-4e7f-91a8-d97c8465520e
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
pythonvspyt551cf:31249601
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
aihoversummaries_f:31453033
3efgi100_wstrepl:31403338
use-responses-api:31390855
ec5jj548:31422691
cp_cls_c_966_ss:31454199
a5gib710:31434435
7a04d226_do_not_restore_last_panel_session:31438103
anthropic_thinking_t:31455736
cp_cls_c_1081:31454833
a43f0574a:31442826
e9c30283:31461165
idci7584:31464702
e3e4d672:31461204
chat:31457767

Metadata

Metadata

Assignees

Labels

info-neededIssue requires more information from postertriage-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