How to Upgrade PIP

If you are a Python coder, There is high change that you would be using pip to install Python packages.

How To Upgrade pip On Linux

Lets see how we can upgrade pip on Linux first.

Lets check the pip version.

In [3]:
pip --version
pip 9.0.1 from /home/anaconda3/lib/python3.7/site-packages (python 3.7)

Lets try installing a python package. example pip install python-levenshtein

In [5]:
pip install python-levenshtein

I got following warning

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

We can also find the latest available version using following command.

In [11]:
pip search pip | egrep pip | egrep -i pypa
pip (19.3.1)                          - The PyPA recommended tool for installing Python packages.
You are using pip version 9.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

To install the version we can either run the command pip install --upgrade pip or do pip install pip==19.3.1

Lets try first pip install --upgrade pip first

In [12]:
pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 1.1MB/s eta 0:00:01
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-19.3.1
In [13]:
pip --version
pip 19.3.1 from /home/anaconda3/lib/python3.7/site-packages/pip (python 3.7)

Lets try now pip install pip==19.3.1

In [14]:
pip install pip==19.3.1
Requirement already satisfied: pip==19.3.1 in /home/anaconda3/lib/python3.7/site-packages (19.3.1)

How to upgrade pip3.8

If you are using Python3+, Then you will have to update pip3 to avoid following error...

WARNING: You are using pip version 19.2.3, however version 20.2.1 is available or WARNING: You are using pip version 21.0.1; however, version 21.1.3 is available.

Let us check the current version of pip3.8 first.

In [1]:
pip3.8 --version
pip 19.2.3 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
In [2]:
pip3.8 install pip==20.2.1
Collecting pip==20.2.1
  Downloading https://files.pythonhosted.org/packages/bd/b1/56a834acdbe23b486dea16aaf4c27ed28eb292695b90d01dff96c96597de/pip-20.2.1-py2.py3-none-any.whl (1.5MB)
     |████████████████████████████████| 1.5MB 3.5MB/s eta 0:00:01
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-20.2.1
In [3]:
pip3.8 --version
pip 20.2.1 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

Or You can upgrade using the update command as shown below...

In [ ]:
python3.8 -m pip install --upgrade pip

How To Upgrade Pip In Windows.

If you have Cygwin installed. Then the above commands for Linux should work on Cygwin too.

Otherwise first check the pip version. Use python -m for every command

In [15]:
python -m pip --version

To install specific version

In [16]:
python -m pip install pip==19.3.1

Or use following command

In [17]:
python -m pip install --upgrade pip

Related Topics: