feat: fall back to system Python when pre-built binaries unavailable by gounthar · Pull Request #1289 · actions/setup-python

@gounthar

When pre-built Python binaries are not available for the current
architecture (e.g., riscv64), try using system Python as a fallback
instead of failing with an error.

This enables setup-python to work on architectures that don't yet
have pre-built binaries in actions/python-versions, such as riscv64
self-hosted runners. The fallback only activates when:
1. No cached version is found
2. No manifest entry exists for the architecture
3. System python3 exists and satisfies the requested version spec

A warning is emitted so users know the fallback was used.

Fixes actions#1288

Signed-off-by: Bruno Verachten <gounthar@gmail.com>

Copilot AI review requested due to automatic review settings

March 18, 2026 14:48

This was referenced

Mar 18, 2026

@gounthar

- Gate fallback on architecture having no manifest entries, preventing
  false triggers on supported architectures with missing versions
- Skip fallback for free-threaded Python builds
- Return early with correct outputs (sys.executable, version, bin dir)
  instead of relying on toolcache path parsing which breaks with
  system prefix paths like /usr
- Set environment variables (pythonLocation, Python_ROOT_DIR, etc.)
  correctly for system Python paths

Signed-off-by: Bruno Verachten <gounthar@gmail.com>

@gounthar

Signed-off-by: Bruno Verachten <gounthar@gmail.com>