No module named pip on self-hosted runner
Description
Hello,
I am observing the following error when using pypa/[email protected] in my action:
/home/username/actions-runner/_work/_tool/Python/3.12.9/x64/bin/python: No module named pip
Traceback (most recent call last):
File "<stdin>", line 28, in <module>
File "/home/username/actions-runner/_work/_tool/Python/3.12.9/x64/lib/python3.12/venv/__init__.py", line 80, in create
self.post_setup(context)
File "<stdin>", line 20, in post_setup
File "/home/username/actions-runner/_work/_tool/Python/3.12.9/x64/lib/python3.12/subprocess.py", line 573, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/username/actions-runner/_work/_tool/Python/3.12.9/x64/bin/python', '-m', 'pip', '--python', '/home/username/actions-runner/_work/_temp/cibw/bin/python', 'install', '/home/username/actions-runner/_work/_actions/pypa/cibuildwheel/v2.22.0']' returned non-zero exit status 1.
The error happens at the Install cibuildwheel step (https://github.com/pypa/cibuildwheel/blob/c93d51ec540da7537ae66107a32c60dccd705102/action.yml#L36).
The machine is Ubuntu 23 with python3 and python3-pip installed through apt (externally managed environment).
Build log
No response
CI config
No response
You need to have setup-python to use our action. If you cannot use setup-python, you should not use our action either. Just use cibuildwheel directly with your externally managed pip.
There's probably something going wrong with setup-python indeed. Are there any logs for the setup-python sub-step of the action ?
The fact that update-environment: true seems to work suggests that it might be an LD_LIBRARY_PATH like issue. c.f. https://github.com/actions/setup-python/issues/871 / https://github.com/actions/python-versions/pull/275
May you try to create virtualenv and provide python by virtualenv to not have an externally managed environment?
Our action uses setup-python, which itself is not supposed to break like this - the links above might be the root bug.