actions / actions/setup-python

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

Offen
#1,050 13 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
TypeScript
Sterne
2.2k
Forks
739
Ø Merge
6 T. 18 Std.
Gemergte PRs (30 T.)
1

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der pip-Cache-Logik in src/cache-distributions/pip-cache.ts an den referenzierten Zeilen und vergleiche dann, wie src/install-pypy.ts die installierten Python-Tools aufruft. Reproduziere den Windows-self-hosted-Workflow mit deaktiviertem update-environment und verifiziere, dass das pip-Caching erfolgreich ist, wenn pip in PATH fehlt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
github-actions, typescript
Bereich
ci-cd
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

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