Visitar URL original
Windows launcher finds but fails to launch Python <3.9 · Issue #93263 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250618144847/https://github.com/python/cpython/issues/93263
Skip to content

Windows launcher finds but fails to launch Python <3.9 #93263

Closed as not planned
Closed as not planned
@kroeschl

Description

@kroeschl

Bug report

The py launcher finds but will not run Python versions before at latest 3.9.12. Found on a system with Python 3.6,7,8,9,10 and 2.7 installed. Example trying to launch Python 3.6:

> py -3.6 -V
Installed Pythons found by C:\Windows\py.exe Launcher for Windows *

Requested Python version (3.6) not installed, use -0 for available pythons
Python 3.6 not found!

 -3.10-64
 -3.9-64
 -3.8.10-64
 -3.7.9-64
 -3.6.8-64
 -2.7.18-64
Output with debugging enabled
> PYLAUNCH_DEBUG=1 py -3.6 -V
launcher build: 32bit
launcher executable: Console
File 'C:\Users\Administrator\AppData\Local\py.ini' non-existent
File 'C:\Windows\py.ini' non-existent
Called with command line: -3.6 -V
locating Pythons in 64bit registry
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\2.7.18\python.exe is a 64bit executable
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe is a 64bit executable
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.6.8\python.exe is a 64bit executable
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.7.9\python.exe is a 64bit executable
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.8.10\python.exe is a 64bit executable
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe is a 64bit executable
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: : The system cannot find the path specified.
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: unable to open PythonCore key in HKLM
locating Pythons in native registry
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\2.7.18\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\2.7.18\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\2.7.18\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\2.7.18\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.6.8\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.6.8\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.6.8\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.6.8\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.7.9\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.7.9\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.7.9\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.7.9\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.8.10\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.8.10\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.8.10\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.8.10\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.12\python.exe: already found
locate_pythons_for_key: unable to open PythonCore key in HKLM
locate_pythons_for_key: unable to open PythonCore key in HKLM
search for Python version '3.6' found no interpreter
found no configured value for 'python'
search for default Python found version 3.10 at 'C:\Users\Administrator\.pyenv\pyenv-win\versions\3.10.4\python.exe'
Installed Pythons found by C:\Windows\py.exe Launcher for Windows *

Requested Python version (3.6) not installed, use -0 for available pythons
Python 3.6 not found!

 -3.10-64
 -3.9-64
 -3.8.10-64
 -3.7.9-64
 -3.6.8-64
 -2.7.18-64
Registry tree
>reg query HKCU\SOFTWARE\Python\PythonCore

HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore
    DisplayName    REG_SZ    Python Software Foundation
    SupportUrl    REG_SZ    https://www.python.org/

HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7.18
HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.10
HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.10.4
HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.6.8
HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.7.9
HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.8.10
HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.9
HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.9.12

From poking through the launcher source, it looks like this is caused by:

  • validate_version() only allows specifying up to the minor version, not patch.
  • find_python_by_version() requires that the version either be single-digit (e.g. py -3) or an exact match with whatever we have in our list of found Python versions.
  • Our registry-based Python lookup gets the version from the branch names under ..\SOFTWARE\Python\PythonCore, which defaults to only the full version for Python ending somewhere between 3.8.10 and 3.9.12.

The current launcher should probably be compatible with at least Python versions still in support. My current workaround for this issue is to reg copy the fully-qualified branches under PythonCore to branches only specified to the minor version:

reg copy HKCU\SOFTWARE\Python\PythonCore\3.8.10 HKCU\SOFTWARE\Python\PythonCore\3.8 /s /f

Your environment

  • CPython versions tested on: 3.10.4
    Also installed on the system: 2.7.18, 3.6.8, 3.7.9, 3.8.10, 3.9.12
  • Operating system and architecture: Windows 10 64-bit

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions