Skip to content

Bug: "Unable to handle" error when selecting Python interpreter from uv-managed .venv #25886

Closed

Description

Type: Bug

Environment

  • OS: Windows 11
  • Editor: Kiro (VS Code-based)
  • Python Extension version: v2026.4.0
  • Python: 3.13.5
  • Package manager: uv 0.11.1

Steps to Reproduce

  1. Create a new project using uv init
  2. Run uv venv and uv sync to create the virtual environment
  3. Open the project in the editor
  4. Ctrl + Shift + P → "Python: Select Interpreter"
  5. Choose "Enter interpreter path..." → "Find..."
  6. Navigate to .venv\Scripts\python.exe and select it

Expected Behavior

The interpreter should be set to .venv\Scripts\python.exe without errors.

Actual Behavior

Error message: "Unable to handle c:\Users[username]....venv\Scripts\python.exe"

The interpreter is not set. The .venv is valid and .venv\Scripts\python.exe --version returns Python 3.13.5 successfully from the terminal.

Workaround

Manually setting the interpreter path in .vscode/settings.json works:

{
    "python.defaultInterpreterPath": "${workspaceFolder}\\.venv\\Scripts\\python.exe"
}

Additional Info

The virtual environment was created by uv (v0.11.1). The issue appears to be with the interpreter picker UI, not the venv itself.

Extension version: 2026.4.0
VS Code version: Code 1.112.0 (07ff9d6178ede9a1bd12ad3399074d726ebe6e43, 2026-03-17T18:09:23Z)
OS version: Windows_NT x64 10.0.22631
Modes:

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

languageServer: "Pylance"

</p>
</details>

<details>
<summary>Installed Extensions</summary>

|Extension Name|Extension Id|Version|
|---|---|---|
|astronomic-theme|mys|0.9.2|
|bruno|bru|4.5.0|
|debugpy|ms-|2025.18.0|
|js-debug|ms-|1.112.0|
|js-debug-companion|ms-|1.1.3|
|json-sort-and-compare|far|0.0.6|
|python|ms-|2026.4.0|
|remote-wsl|ms-|0.104.3|
|ruff|cha|2026.38.0|
|vscode-js-profile-table|ms-|1.0.10|
|vscode-pylance|ms-|2026.1.1|
|vscode-python-envs|ms-|1.24.0|
</details>

<!-- generated by issue reporter -->

Activity

  1. eleanorjboyd commented on Apr 3, 2026

    @eleanorjboyd
    Member

    Two questions here:

    • Does this reproduce in official VS Code Stable/Insiders as well, or only in Kiro?
    • What do Python and Python Environments output channels show at Trace level during the failed selection?
  2. camhelkuik commented on Apr 6, 2026

    @camhelkuik
    Author
    1. It appears that in the official VS Code Stable it does NOT reproduce. This issue only happens in Kiro.
    2. Here is the output channel when trying to select a python interpreter showing the Trace level :
    2026-04-06 10:32:18.143 [debug] Checking venv (ms-python.python:venv) for c:\Users\.....\.venv\Scripts\python.exe
    2026-04-06 10:32:18.143 [debug] Failed to resolve venv env "c:\Users\.....\.venv\Scripts\python.exe": 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-04-06 10:32:18.143 [debug] Failed to resolve env "c:\Users\.....\.venv\Scripts\python.exe": 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-04-06 10:32:18.143 [debug] Manager venv (ms-python.python:venv) cannot handle c:\Users\.....\.venv\Scripts\python.exe
    2026-04-06 10:32:18.143 [debug] Checking Conda (ms-python.python:conda) for c:\Users\.....\.venv\Scripts\python.exe
    2026-04-06 10:32:18.143 [debug] Checking Global (ms-python.python:system) for c:\Users\.....\.venv\Scripts\python.exe
    2026-04-06 10:32:18.144 [debug] Failed to resolve env "c:\Users\.....\.venv\Scripts\python.exe": 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-04-06 10:32:18.144 [error] Unable to handle c:\Users\.....\.venv\Scripts\python.exe
    
    1. When I try to run: Python Environments: Run Python Environment Tool (PET) in Terminal in the command palette, Find All Environments:
    c:\Users\..\.kiro\extensions\ms-python.python-2026.4.0-universal\python-env-tools\bin\pet.exe find --verbose
    &: The term 'c:\Users\..\.kiro\extensions\ms-python.python-2026.4.0-universal\python-env-tools\bin\pet.exe' is not recognized as a name of a cmdlet, function, script file, or executable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
    
    1. When I try to run Python Environments: Run Python Environment Tool (PET) in Terminal in the command palette, Resolve Environment:
    PS C:\Users\..\automate-everything-with-python\accessing-apis> & c:\Users\..\.kiro\extensions\ms-python.python-2026.4.0-universal\python-env-tools\bin\pet.exe resolve "C:\Users\..\automate-everything-with-python\accessing-apis\.venv\Scripts\python.exe"
    &: The term 'c:\Users\..\.kiro\extensions\ms-python.python-2026.4.0-universal\python-env-tools\bin\pet.exe' is not recognized as a name of a cmdlet, function, script file, or executable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    
  3. eleanorjboyd commented on Apr 22, 2026

    @eleanorjboyd
    Member

    Closing this issue — it's a Kiro-specific PET binary issue, not a VS Code or extension bug.

    This is also a duplicate of microsoft/vscode-python-environments#1394 for the general "Unable to handle" class of issues.

    If you experience this in official VS Code (not Kiro), please file a new issue with output logs from the "Python Environments" output channel. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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