You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PIP_ROOT_USER_ACTION=ignore ignored: pip still issues error messages about running it as root #930
Description:
setup-action@v5 and python-version: 3.11 leads to pip's warnings about running as root, which should have been suppressed by the install script on self-hosted runner and GHES 3.12.8.
job running under an ubuntu:jammy container image, as root (without 'options: --user ...)
setup-python step like so:
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.11'
Expected behavior:
No warnings, since the the install script seems to properly export PIP_ROOT_USER_ACTION=ignore.
Actual behavior:
pip throws the known errors (warnings?) about running it as root:
Error: WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behavior with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Error: WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
This is related to #513, which, although initially opened as a feature request and closed as such, is still receiving updates from people impacted by the same problem.
Hello @RoFz 👋,
Thankyou for reporting the issue! The warning about the pip cache within Docker containers arises because the directory /github/home/.cache/pip is either not owned by or not writable by the current user. The ownership and permissions might not align with the user running the pip command.
To resolve this issue, please try the following step before the setup-python action:
-name: Change ownership of /github/homerun: sudo chown -R $(whoami) /github/home
Regarding the warning related to running pip as root: The setup-python action correctly sets the PIP_ROOT_USER_ACTION=ignore environment variable. This setting works as expected for more recent pip versions (23.0.1 and above).
Therefore, this is expected behaviour and is not related to the setup-python action.
Hope this clarifies the situation.
Hello @RoFz 👋,
I hope the suggested workaround has addressed the issue related to the pip cache warning.
Thank you, @maikelvdh, for your valuable insights regarding the pip cache warning 😊. As you correctly pointed out, the warning from the ensurepip command is due to the environment context being sanitized.
PIP_ROOT_USER_ACTION has no effect for the called ensurepip command which is printing this respective warning.
Additionally, the PIP_ROOT_USER_ACTION=ignore variable is correctly set and functions as expected for pip versions >=23.0.2 in the setup-python action.
Since this behaviour is inherent to pip and not specifically related to the setup-python action, I am proceeding to close this issue. Please feel free to reopen this issue or create a new one incase of any further concerns.
Activity
RoFz commentedon Aug 28, 2024
Additional note: also tried with setup-python@v4 and specific python versions 3.11.9 and 3.11.8.
v-priyagupta108 commentedon Aug 29, 2024
Hello @RoFz 👋,
Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.
v-priya-kinthali commentedon Sep 20, 2024
Hello @RoFz 👋,
Thankyou for reporting the issue!
The warning about the pip cache within Docker containers arises because the directory
/github/home/.cache/pipis either not owned by or not writable by the current user. The ownership and permissions might not align with the user running the pip command.To resolve this issue, please try the following step before the setup-python action:
Regarding the warning related to running pip as root: The
setup-pythonaction correctly sets thePIP_ROOT_USER_ACTION=ignoreenvironment variable. This setting works as expected for more recent pip versions (23.0.1 and above).Therefore, this is expected behaviour and is not related to the
setup-pythonaction.Hope this clarifies the situation.
maikelvdh commentedon Sep 27, 2024
@priya-kinthali the
PIP_ROOT_USER_ACTIONhas no effect for the calledensurepipcommand which is printing this respective warning. Reason seems that this module is sanitising the environment context, see: https://github.com/python/cpython/blob/main/Lib/ensurepip/__init__.py#L97-L106.v-priya-kinthali commentedon Oct 1, 2024
Hello @RoFz 👋,
I hope the suggested workaround has addressed the issue related to the pip cache warning.
Thank you, @maikelvdh, for your valuable insights regarding the pip cache warning 😊. As you correctly pointed out, the warning from the
ensurepipcommand is due to the environment context being sanitized.Additionally, the PIP_ROOT_USER_ACTION=ignore variable is correctly set and functions as expected for pip versions >=23.0.2 in the
setup-pythonaction.Since this behaviour is inherent to
pipand not specifically related to thesetup-pythonaction, I am proceeding to close this issue. Please feel free to reopen this issue or create a new one incase of any further concerns.Thank you for your patience! 😊
Remove use of setup-python and use script to install python/pip (#130)
Remove use of setup-python and use script to install python/pip (#130)