-
Notifications
You must be signed in to change notification settings - Fork 684
Description
Description:
Downstream issue: msys2/msys2-autobuild@fe4bcd0#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: falseerror:
[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:
setup-python/src/cache-distributions/pip-cache.ts
Lines 35 to 41 in 9e62be8
| ({stdout: stdout, stderr: stderr} = await execPromisify('pip cache dir')); | |
| } else { | |
| ({ | |
| stdout: stdout, | |
| stderr: stderr, | |
| exitCode: exitCode | |
| } = await exec.getExecOutput('pip cache dir')); |
In other places this is handled correctly by explicitly going through the just installed python/pip, for example:
setup-python/src/install-pypy.ts
Lines 177 to 182 in 9e62be8
| const pythonBinary = path.join(pythonLocation, 'python'); | |
| await exec.exec(`${pythonBinary} -m ensurepip`); | |
| await exec.exec( | |
| `${pythonLocation}/python -m pip install --ignore-installed pip` | |
| ); |
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