Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress pip upgrade warning?

Tags:

python

pip

My pip version was off -- every pip command was saying:

You are using pip version 6.0.8, however version 8.1.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. 

And I didn't like the answers given here: How can I get rid of this warning to upgrade from pip? because they all want to get pip out of sync with the RH version.

So I tried a clean system install with this VagrantFile:

Vagrant.configure("2") do |config|    config.ssh.username   = 'root'   config.ssh.password   = 'vagrant'   config.ssh.insert_key = 'true'    config.vm.box = "bento/centos-7.3"    config.vm.provider "virtualbox" do |vb|     vb.cpus   = "4"     vb.memory = "2048"   end    config.vm.synced_folder "..", "/vagrant"    config.vm.network "public_network", bridge: "eth0", ip: "192.168.1.31"    config.vm.provision "shell", inline: <<-SHELL     set -x      # Install pip     yum install -y epel-release     yum install -y python-pip     pip freeze   # See if pip prints version warning on fresh OS install.    SHELL  end 

But then I got:

==> default: ++ pip freeze ==> default: You are using pip version 8.1.2, however version 9.0.1 is available. ==> default: You should consider upgrading via the 'pip install --upgrade pip' command. 

So it seems that I'm using the wrong commands to install pip. What are correct commands to use?

like image 828
personal_cloud Avatar asked Sep 18 '17 22:09

personal_cloud


People also ask

How do I update pip upgrade?

Updating Pip b is available.” You can run “pip install --upgrade pip” to install and use the new version of pip. To update pip2 or pip3 using this command, only replace the first pip with the pip version.

Should I upgrade pip version?

New software releases can bring bug fixes, new features, and faster performance. For example, NumPy 1.20 added type annotations, and improved performance by using SIMD when possible. If you're installing NumPy, you might want to install the newest version.

What is the flag for pip install?

The --user flag to pip install tells Pip to install packages in some specific directories within your home directory. This is a good way to have your own default Python environment that adds to the packages within your system directories, and therefore, does not affect the system Python installation.

How do I upgrade my Pip version?

You might see the above warning message when you run pip or pip3 commands on your terminal if your pip version is not the latest one. As the warning suggests you need to upgrade to the latest version to get this warning go away by simply running the command "pip install --upgrade pip"

Should I learn to ignore the PIP warning?

Or learn to ignore it. In that case you're going to need to learn to ignore the warning. This warning only goes away when you get the latest version of pip from pypi. The version packaged for centos will almost always be older than that. I don't want pip going out and breaking things. I want a vagrant script that has known versions of everything.

What is the latest Pip version for Linux?

The command for this is thankfully very simple: You can check what the latest pip version is here and decide whether to update accordingly. At the time of writing, the latest pip version is 22.0.4. Our server is on 20.0.2, so an upgrade is definitely in order.

Does pipx upgrade or upgrade-all try to upgrade shared libs?

If pipx upgrade or upgrade-all is run, it already tries to upgrade shared libs. Maybe we could just document that it does this, and avoid adding a new subcommand.


1 Answers

There are many options (2021 update)...

Use a command line flag

pip <command> --disable-pip-version-check [options] 

Configure pip from the command line

pip config set global.disable-pip-version-check true 

Set an environment variable

export PIP_DISABLE_PIP_VERSION_CHECK=1 

Use a config file

Create a pip configuration file and set disable-pip-version-check to true

[global] disable-pip-version-check = True 

On many linux the default location for the pip configuration file is $HOME/.config/pip/pip.conf. Locations for Windows, macOS, and virtualenvs are too various to detail here. Refer to the docs:

https://pip.pypa.io/en/stable/user_guide/#config-file

like image 151
John Mee Avatar answered Sep 30 '22 16:09

John Mee