Disable warnings while pip installing packages

Viewed 13471

Can I somehow disable warning from PIP while it installs packages? I haven't found such an option in pip usage! I'm trying to install packages using python script (2.7.8) and check whether it was successful:

p = subprocess.Popen(
    'pip install requests',
    shell=True,
    executable='/bin/bash',
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE
)
out, err = p.communicate()
if err:
    sys.stdout.write('Error occured while executing: %s' % err)

I get a warning from PIP:

You are using pip version 7.1.2, however version 8.1.1 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

And I'm not allowed to upgrade PIP, I need to use this one.

2 Answers

The question title is not only about version check, but about all warnings. To disable running as root warnings, which you can run into frequently when using docker containers, from pip 22.1, you can additionally do

pip install --disable-pip-version-check --root-user-action=ignore

as mentioned in this answer.

Related