actions / actions/setup-python
Fails to run on self hosted Windows runner if pip is not in PATH
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 2.2k
- Fork
- 739
- Merge medio
- 6g 18h
- PR unite (30g)
- 1
Descrizione
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
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dalla logica della cache di pip in src/cache-distributions/pip-cache.ts alle righe indicate, quindi confronta il modo in cui src/install-pypy.ts richiama gli strumenti Python installati. Riproduci il workflow self-hosted di Windows con update-environment disabilitato e verifica che il caching di pip abbia esito positivo quando pip non è presente in PATH.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- github-actions, typescript
- Ambito
- ci-cd
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 48/100