Closed ssalmani-ledger closed 1 year ago
Hi @ssalmani-ledger, thank you for your suggestion, we will take a look at this.
Similarly, I am seeing a warning for the pip version, despite it upgrading it:
WARNING: You are using pip version 21.1.1; however, version 22.2.2 is available.
You should consider upgrading via the '/opt/hostedtoolcache/Python/3.9.5/x64/bin/python -m pip install --upgrade pip' command.
(apologies if this is unrelated)
Similar suggestion, I'm using this action to setup python 2 and I always get the Python 2 deprecation warning in the Github Annotations:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
I know that Python 2 is deprecated - I'm using this action to run automated tests on my python code and these need to run in Python 2 and Python 3 so I know my code works in both.
- name: Setup Python 2
uses: actions/setup-python@v3
with:
python-version: '2.x'
For normal "pip" without this module, I can add the option --no-python-version-warning
to make it shut up about Python 2 being deprecated, but I found no option for this action to add custom parameters to the Pip call, nor did I find a dedicated option to make it not output these deprecation warnings.
Can this be added?
@vsafonkin
hey, am I correct in that changing this function https://github.com/actions/setup-python/blob/main/src/install-pypy.ts#L151
to check an env var/input and then add --root-user-action=ignore
if its set would fix this?
Hello everyone. For now I'm going to close the feature request because we're not planing to add the separate input to pass parameters for pip.
We added logic for scripts to ignore the majority warnings and --root-user-action=ignore
will be added for the next versions. For now you can specify global env variables to achieve the same behaviour:
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
PIP_NO_PYTHON_VERSION_WARNING: 1
PIP_ROOT_USER_ACTION: ignore
@Leseratte10 Unfortunately for older pip versions this option does not work.
I also have a self-hosted runner on EC2. My configuration is as suggested:
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
env:
PIP_ROOT_USER_ACTION: ignore
Yet still the warning persists. @dmitry-shibanov do I understand you correctly and the next release is what I have to wait for?
Hello @flipcc. You need to put this env variables on the job level.
I set the env var at step level, at job level and I tried adding it to $GITHUB_ENV in preparation, but the action does not seem to consider environment variables. @ssalmani-ledger did you ever suppress the warning?
@dmitry-shibanov I can also confirm the following doesn't work as the error persists:
jobs:
run-tests:
runs-on: [self-hosted, spot]
env:
PIP_ROOT_USER_ACTION: ignore
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.9"
I tried on step, job, and global level - all still show the error.
I'm using a self-hosted runner using ubuntu:latest
docker image.
Note: this error wasn't present on Github Hosted ubuntu:latest
runners. Only when I switched to self-hosted. So I ended up installing python3.9
and python-pip
as part of the Dockerfile
and removed actions/setup-python@v4
from my workflow. All good now.
this issue still occurs with self-hosted runners. it doesn't happen every time, just sometimes. in a dozen jobs maybe 2-4 will show this message. They all are the same runner type.
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
env:
PIP_ROOT_USER_ACTION: "ignore"
jobs:
initial:
runs-on: [self-hosted,Linux,Standard,X64]
defaults:
run:
shell: pwsh
env:
PIP_ROOT_USER_ACTION: "ignore"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup Python
uses: actions/setup-python@v4.7.0
with:
python-version: '3.x'
i can make a new issue if that would be better.
Can confirm that this is still an issue.. @dmitry-shibanov Do you want us to open a new issue?
By May 16th 2024 I can confirm this issue is still happening. Cannot get rid of the error no matter where I set up the environment variables to silence it.
I can confirm that
env:
PIP_ROOT_USER_ACTION: ignore
doesn't solve the problem. But I find that this does:
steps:
- run: echo PIP_ROOT_USER_ACTION=ignore >> $GITHUB_ENV
shell: bash
- uses: actions/setup-python@v5
EDIT: nope, I'm wrong. Can't silence this warning.
Not in self-managed runners
same issue
Description: Have an option to suppress warnings during Python installation.
Justification: I'm using self-hosted runners in EC2 and I have constantly the
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
warning (which is capture by GitHub actions as an error). It would be nice to have an option to suppress these warnings so that these errors are not mixed up with the other warnings raised in the other steps.Note: It's also not possible for me to use a non-root user when running the workflow in the EC2 instance, as explained here: https://github.com/machulav/ec2-github-runner/issues/64#issuecomment-907688504.