setup-python fails on self-hosted macOS: newer darwin Python assets require interactive sudo (installer -pkg)

Offen
#1,388 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
30/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
github-actions, macos, shell, typescript
Bereich
ci-cd, devops

Rechercherichtung

The failing sudo installer -pkg call comes from the generated setup.sh, built from installers/macos-pkg-setup-template.sh (line 50) in actions/python-versions, so that template is the first file to read. The error surfaces in setup-python's install-from-prebuilt-package step, which is where an explicit failure message would go. Done means either a documented sudo requirement or a clear error for the no-TTY case, and the maintainers still need to decide whether a relocatable layout is in scope.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Problem

On a self-hosted macOS runner, actions/setup-python@v7 fails for Python versions whose darwin asset installs via sudo installer -pkg (e.g. 3.12.10):

Version 3.12 was not found in the local cache
Download from .../python-3.12.10-darwin-arm64.tar.gz
Execute installation script
Check if Python hostedtoolcache folder exist...
Install Python binaries from prebuilt package
##[error]sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper

The asset's setup.sh (generated from actions/python-versions installers/macos-pkg-setup-template.sh, line 50) runs:

sudo installer -pkg $PYTHON_PKG_NAME ... -target /

The runner service user has no TTY, so any host without passwordless sudo for /usr/sbin/installer fails. Older assets (e.g. 3.11.9) shipped plain directory trees and installed unprivileged.

Suggestion

Document the sudo requirement and/or fail with an explicit message; a relocatable (unprivileged) darwin asset layout would remove the requirement entirely.

Related: #914, #1387.

🤖 Generated with Claude Code

Vorherrschende Sprache
TypeScript
Sterne
2.3k
Forks
752
Ø Merge
22 T. 15 Std.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus actions/setup-python

Alle Issues in actions/setup-python

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.