actions / actions/setup-python

Fails to run on self hosted Windows runner if pip is not in PATH

オープン
#1,050 コメント 13 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
TypeScript
スター
2.2k
フォーク
739
平均マージ
6日 18時間
マージ済み PR(30日)
1

説明

Description:

Downstream issue: https://github.com/msys2/msys2-autobuild/commit/fe4bcd08a9fbdd4a2874a67b4491991a76d784a7#commitcomment-153600091

Running the following on a self-hosted Windows runner leads to:

    - uses: actions/setup-python@v5
      id: python
      with:
        python-version: '3.13'
        cache: 'pip'
        cache-dependency-path: 'requirements.txt'
        architecture: 'x64'
        update-environment: false

error:

[error]Command failed: pip cache dir
'pip' is not recognized as an internal or external command,
operable program or batch file.

The problematic thing being "update-environment" (which we need to set, so it doesn't set cmake and pkg-config variables interfering with our builds. I don't mind the PATH, but setup-python only does all or nothing)

It looks like the cache code depends on pip being globally available, while it might not be: https://github.com/actions/setup-python/blob/9e62be81b28222addecf85e47571213eb7680449/src/cache-distributions/pip-cache.ts#L35-L41. This likely just works on the hosted runners since there pip is installed already.

In other places this is handled correctly by explicitly going through the just installed python/pip, for example: https://github.com/actions/setup-python/blob/9e62be81b28222addecf85e47571213eb7680449/src/install-pypy.ts#L177-L182

Action version:
actions/setup-python@v5

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

3.13, but any really

Repro steps:
See above

Expected behavior:
The action to run

Actual behavior:
It errors out

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、指定された行にある src/cache-distributions/pip-cache.ts の pip キャッシュロジックから始め、次に src/install-pypy.ts がインストール済みの Python ツールをどのように呼び出すかを比較します。update-environment を無効にした Windows self-hosted workflow を再現し、pip が PATH にない場合でも pip のキャッシュが成功することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
github-actions, typescript
領域
ci-cd
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。