Skip to content

[BUG] Unable to detect or recognize python executable on certain machines #1357

@mogres

Description

@mogres

Type: Bug

Behaviour

Python environments extension is having trouble recognizing the python executable on certain machines accessed via remote explorer. Python environment tool fails after three attempts.

I am able to activate and execute python venv through the command line, but the extension fails with the error: Selected file is not a valid python interpreter

Steps to reproduce:

  1. Open a python file
  2. Click Select Python Interpreter from the status bar (this should have been auto-recognized)
  3. Provide path to executable (.venv/bin/python) in the local directory, verified working through a clean terminal outside vscode.

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-13 17:40:54.274 [error] [
  'Failed to activate a workspace, Class name = v, completed in 170ms, has a falsy return value, Arg 1: <Uri:[REDACTED]>, 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.

Running the python environment tool from the terminal using:

.vscode-server/extensions/ms-python.vscode-python-envs-1.22.0-linux-x64/python-env-tools/bin/pet resolve .venv/bin/python

works as expected with output:

Environment found for ".venv/bin/python"
Environment (Uv)
   Name        : [REDACTED]
   Executable  : .venv/bin/python
   Version     : 3.11.12.final.0
   Prefix      : [REDACTED]
   Architecture: x64
   Symlinks    : ".venv/bin/python"
               : ".venv/bin/python3"
               : ".venv/bin/python3.11"
               : "[REDACTED]"

Resolve completed in 984ms

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

2026-03-13 18:03:11.767 [debug] Checking venv (ms-python.python:venv) for [REDACTED-LOCAL-PATH-TO-VENV-PYTHON-EXECUTABLE]
2026-03-13 18:03:11.767 [debug] Failed to resolve venv env "[REDACTED-LOCAL-PATH-TO-VENV-PYTHON-EXECUTABLE]": 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.
2026-03-13 18:03:11.767 [debug] Failed to resolve env "[REDACTED-LOCAL-PATH-TO-VENV-PYTHON-EXECUTABLE]": 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.
2026-03-13 18:03:11.767 [debug] Manager venv (ms-python.python:venv) cannot handle [REDACTED-LOCAL-PATH-TO-VENV-PYTHON-EXECUTABLE]
2026-03-13 18:03:11.767 [debug] Checking PyEnv (ms-python.python:pyenv) for /a[REDACTED-LOCAL-PATH-TO-VENV-PYTHON-EXECUTABLE]
2026-03-13 18:03:11.768 [debug] Checking Conda (ms-python.python:conda) for [REDACTED-LOCAL-PATH-TO-VENV-PYTHON-EXECUTABLE]
2026-03-13 18:03:11.768 [debug] Checking Global (ms-python.python:system) for [REDACTED-LOCAL-PATH-TO-VENV-PYTHON-EXECUTABLE]
2026-03-13 18:03:11.768 [debug] Failed to resolve env "[REDACTED-LOCAL-PATH-TO-VENV-PYTHON-EXECUTABLE]": 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.
2026-03-13 18:03:11.768 [warning] Unable to handle [REDACTED-LOCAL-PATH-TO-VENV-PYTHON-EXECUTABLE]

Extension version: 1.22.0
VS Code version: Code 1.111.0 (Universal) (ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb, 2026-03-06T23:06:10Z)
OS version: Darwin arm64 24.6.0
Modes:
Remote OS version: Linux x64 6.8.0-101-generic

System Info
Item Value
CPUs Apple M3 Pro (11 x 2400)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, ANGLE Metal Renderer: Apple M3 Pro, Version 15.7.4 (Build 24G517))], DRIVER_VENDOR=Apple, DRIVER_VERSION=15.7.4 ACTIVE
Machine model name: Mac
Machine model version: 15.6
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: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 5, 7, 7
Memory (System) 18.00GB (0.13GB free)
Process Argv --crash-reporter-id 4cc5ea00-98f8-4d51-a3d7-5459c121cccd
Screen Reader no
VM 0%
Item Value
Remote SSH: [REDACTED]
OS Linux x64 6.8.0-101-generic
CPUs Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz (32 x 1200)
Memory (System) 251.76GB (246.42GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
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:31469309
3efgi100_wstrepl:31403338
use-responses-api:31390855
defaultusage:31403421
je187915:31401257
ec5jj548:31422691
cp_cls_t_966_ss:31454198
find_all_ref_in_bg_f:31469307
ge8j1254_inline_auto_hint_haiku:31431912
nes-autoexp-10:31446583
7a04d226_do_not_restore_last_panel_session:31438103
cp_cls_t_1081:31454832
ia-use-proxy-models-svc:31452481
a43f0575b:31442825
e9c30283:31461165
test_treatment2:31471001
nes-conv-2-3:31474331
control_6dc23131:31467998
idci7584:31464702
edit_mode_hidden:31461530
864ei723_large_tool_results_to_disk:31460878
notips:31471632
b1f5h706:31471673
nes-extended-on:31455476
chat:31457767
0h66b693:31473807
nes-rcnt-prop:31471616
8a2c4887_5_3_codex_prompt:31475326
cpptoolson-v2:31475363
4dgh1208:31471592
hover1:31474145
thinking_c:31471065
c3257622:31473910
noiconchange:31473925
h08i8180:31475369
nes-notsn-1:31475122

Metadata

Metadata

Assignees

Labels

area-environmentEnvironment, interpreter related issues.bugIssue identified by VS Code Team member as probable bugconfirmation-pendingThe issue needs to be confirmed through a maintainer reproducing the bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions