Skip to content

[Bug]: Python not detected when it lives behind a Store App Execution Alias (pyenv-win, and others) #1324

Description

@magnetica

What happened?

On Windows, the dependency check reports "Python not found in PATH" on a machine
where python works fine from a terminal. uv is detected correctly; only Python
fails.

I'm using pyenv-win. python --version prints Python 3.12.9 in any shell, and
uv python list finds the interpreter too, but Window > MCP for Unity > Local
Setup Window insists Python is missing, so setup cannot complete.

The trigger is not pyenv specifically. WindowsPlatformDetector.DetectPython()
looks up the literal name python.exe and validates only the FIRST match where
returns. On a stock Windows install that first match is the Microsoft Store App
Execution Alias at %LOCALAPPDATA%\Microsoft\WindowsApps\python.exe — a 0-byte stub
that exits 9009 when Python wasn't installed from the Store. Detection stops
there and never looks at the PATH entries behind it, so any Python that sits
after the alias is invisible.

Expected: Python 3.12.9 detected, setup proceeds.
Actual: "Python not found in PATH" / "Install Python 3.10+ and ensure it's
added to PATH."

I traced this to three independent bugs (one of which makes extraPathPrepend a
no-op on Windows for every lookup, not just Python) and have a patch with tests.
Posting the full analysis and the diff as a comment below.

Reproduction steps

  1. On Windows 11, leave the default App Execution Aliases enabled (this is the
    out-of-the-box state) and do NOT install Python from the Microsoft Store.
  2. Install Python via pyenv-win:
    pyenv install 3.12.9
    pyenv global 3.12.9
    Confirm it works: python --version -> Python 3.12.9
  3. Install uv and confirm: uv --version
  4. Note what the two lookups return:
    where python -> ....pyenv\pyenv-win\shims\python
    ....pyenv\pyenv-win\shims\python.bat
    ...\AppData\Local\Microsoft\WindowsApps\python.exe
    where python.exe -> ...\AppData\Local\Microsoft\WindowsApps\python.exe
    The plugin queries the second form, which only finds the Store stub.
  5. In Unity, open Window > MCP for Unity > Local Setup Window and run the
    dependency check.
  6. Observe: uv is found, Python is reported as not found.

Any setup where a working interpreter sits behind the WindowsApps alias on PATH
should reproduce step 6; pyenv-win just makes it the common case, because its
shims are .bat files that where python.exe cannot match at all.

Unity version

6000.5.7f1

MCP for Unity package version

10.1.2

Python server version

No response

MCP client

Claude Code

Transport

Don't know

OS

Windows

Relevant logs / console output

=== where lookups ===
> where python
C:\Users\<me>\.pyenv\pyenv-win\shims\python
C:\Users\<me>\.pyenv\pyenv-win\shims\python.bat
C:\Users\<me>\AppData\Local\Microsoft\WindowsApps\python.exe

> where python.exe
C:\Users\<me>\AppData\Local\Microsoft\WindowsApps\python.exe

=== the Store alias, which is what detection ends up probing ===
> (Get-Item "...\WindowsApps\python.exe").Length
0
> & "...\WindowsApps\python.exe" --version
exit code = 9009
stdout    = (empty)
stderr    = Python was not found; run without arguments to install from the
            Microsoft Store, or disable this shortcut from Settings > Apps >
            Advanced app settings > App execution aliases.

=== uv sees the interpreter fine ===
> uv python list
cpython-3.12.9-windows-x86_64-none   C:\Users\<me>\.pyenv\pyenv-win\shims\python.bat
cpython-3.7.8-windows-x86_64-none    C:\Program Files (x86)\...\Python37_64\python.exe

=== DependencyManager.CheckAllDependencies -> DetectPython() ===
Name         : Python
IsAvailable  : False
Version      :
Path         :
Details      : Install Python 3.10+ and ensure it's added to PATH.
ErrorMessage : Python not found in PATH

=== same call, with the patch applied ===
Name         : Python
IsAvailable  : True
Version      : 3.12.9
Path         : C:\Users\<me>\.pyenv\pyenv-win\shims\python3.bat
Details      : Found Python 3.12.9 in PATH
ErrorMessage :

Checks

  • I searched existing issues and did not find a duplicate
  • I included logs / steps to reproduce

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions