-
Notifications
You must be signed in to change notification settings - Fork 664
Description
Description:
I'm using the setup-python
action with CodeBuild self-hosted runners. This works great but does output this warning:
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
This problem has been brought up (but not fixed) by past issues:
- Suppress warnings during Python installation #513
- PIP_ROOT_USER_ACTION=ignore ignored: pip still issues error messages about running it as root #930
There appears to be no way to suppress this warning when using a self-hosted runner. After debugging this, I believe it is happening because ensurepip
is being needlessly invoked in the install script: https://github.com/actions/python-versions/blob/main/installers/nix-setup-template.sh#L54
In ticket #930 it was correctly noted that ensurepip does not honor the PIP_ROOT_USER_ACTION
environment variable. I have also confirmed that it is ensurepip
(and not pip
) producing these warnings. I asked the cpython team about this and as I understand, ensurepip
should only be invoked when initially building python. Because the actions script installs a pre-built python, the call to ensurepip
is not needed and can be removed.
AFAICT there is no specific reason this call is included in the script. Any objection to removing it?
Action version:
v6 and v5 for sure, seemingly others too
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version:
3.11, 3.12, 3.13 for sure
Repro steps:
Just create a step that installs python while running on a CodeBuild-hosted Github Actions runner. Likely will also repro with other types of self-hosted runners too.
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: 3.13
Expected behavior:
Python installs with no warnings
Actual behavior:
Python installs and works well, but prints the below warning:
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv