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

未關閉
#1,388 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
30/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
github-actions, macos, shell, typescript
領域
ci-cd, devops

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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

主要語言
TypeScript
星號
2.3k
分支
752
平均合併
22 天 15 小時
30 天內合併 PR
1

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

actions/setup-python 的其他 Issue

查看 actions/setup-python 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。