Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable warnings while pip installing packages

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.

like image 521
user2975881 Avatar asked Mar 26 '16 11:03

user2975881


People also ask

What is U flag in pip install?

-U, --upgrade Upgrade all packages to the newest available version. So, if you already have a package installed, it will upgrade the package for you. Without the -U switch it'll tell you the package is already installed and exit.


1 Answers

Use pip with option --disable-pip-version-check.

In your code, the command to run will be:

'pip --disable-pip-version-check install requests'

Not all versions of pip support it, but it works in pip 6.0.8 so it should also work for pip 7.1.2.

like image 63
BSharp Avatar answered Sep 21 '22 16:09

BSharp