How to Upgrade PIP in Windows

Often times you may need to upgrade PIP. And so, in this short tutorial, I’ll show you the steps to upgrade PIP in Windows from scratch.

Here are the topics to be covered:

  • Upgrade PIP in Windows
  • Check the version of PIP
  • Simple tool to upgrade PIP
  • Downgrade PIP to a previous version

I first became aware that I needed to upgrade PIP when I was trying to install a Python package using PIP.

I received the following notification:

You are using pip version 10.0.1, however version 18.0 is available. You should consider upgrading via the ‘python -m pip install –upgrade pip’ command.  

 

How to Upgrade PIP in Windows

 

In order to upgrade PIP in Windows, you’ll need to open the Windows Command Prompt, and then type/copy the command below. Note that the following method would only work if you already added Python to Windows path. Don’t worry if you don’t know what it means, as I’ll show the full steps to upgrade pip in windows in the next section.

 

python.exe -m pip install --upgrade pip

Steps to upgrade PIP in Windows

(1) First, type Command Prompt in the Windows search box.

 

Windows search

 

(2) Right click on the Command Prompt, and then select Run as administrator.

By running the Command Prompt as an administrator, you’ll avoid any permission issues.

 

Command Prompt

 

(3) In the Command Prompt, type “cd\” to ensure that your starting point has only the drive name:

 

Admin command prompt

 

(4) Press Enter, and you’ll see the drive name C:\>

 

Administrator command prompt

 

(5) Locate your Python application path, which is the folder where you installed your Python.

In my case, the Python application path is: C:\Program Files (x86)\Python37-32

 

Python application path

 

Once you retrieved the Python application path, type in the Command Prompt:

“cd” followed by the Python application path:

 

Python 37-32

 

(6) Press Enter, and you’ll see:

 

Python37-32

 

(7) To upgrade PIP, type this command, and then press Enter:

 

python.exe -m pip install --upgrade pip

 

python.exe -m pip install --upgrade pip

 

(8) You’ll notice that the newest version of PIP will be installed (in our example, the newest version of PIP is 18.0).

You’ll also notice that the older version of PIP (in our case it was 10.0.1) got uninstalled.

 

Newest version of PIP

 

That’s it! The latest version of PIP should now be installed on your computer.

Steps to check the version of PIP

To check the version of PIP at any time, you’ll need to use the Python Scripts path, rather than the Python application path.

(1) First, type cd\ to ensure that your starting point has only the drive name:

 

Admin command prompt

 

(2) Then, locate your Python Scripts path. The Scripts folder should be located within the Python application path.

In my case, the Python Scripts path is: C:\Program Files (x86)\Python37-32\Scripts

 

Python Scripts Path

 

(3) Type “cd” followed by the Python Scripts path (then press Enter):

 

Python Scripts

 

(4) Finally, type the following command to check the version of PIP:

 

pip --version

 

pip --version

 

(5) Press Enter, and you’ll see the PIP version of 18.0:

 

PIP version of 18.0

Simple tool to upgrade PIP in Windows

In this section of the tutorial, I’ll share with you the code to upgrade PIP using a simple tool I created.

Note that you’ll need to add Python to Windows path in order to start using the tool.

Here is the complete Python code:

 

import os
import tkinter as tk

root= tk.Tk()

canvas1 = tk.Canvas(root, width = 300, height = 350, bg = 'lightsteelblue2', relief = 'raised')
canvas1.pack()

label1 = tk.Label(root, text='Upgrade PIP', bg = 'lightsteelblue2')
label1.config(font=('helvetica', 20))
canvas1.create_window(150, 80, window=label1)

def upgradePIP ():
    os.system('start cmd /k python.exe -m pip install --upgrade pip') 
    
button1 = tk.Button(text='      Upgrade PIP     ', command=upgradePIP, bg='green', fg='white', font=('helvetica', 12, 'bold'))
canvas1.create_window(150, 180, window=button1)

root.mainloop()

 

Simply, run the code, and then press the button ‘Upgrade PIP’ and you should be good to go.

 

upgrade pip in windows

 

Now, what if you’d like to revert back to a previous version of PIP?

You can easily downgrade to a previous version of PIP by following the steps below.

Steps to downgrade PIP to a previous version

(1) Get to the Python application path. If you are currently set to the Python Scripts path, you can simply type “cd..” (then press Enter), and you should revert back to the Python application path:

 

Python37-32

 

(2) Let’s say that you want to downgrade the PIP version to 10.0.1

To do that, simply type the following command, and then press Enter:

 

python.exe -m pip install pip==10.0.1

 

(3) You should now see the version of PIP that you specified:

 

Final Words

If you’re using Anaconda, you may want to check this tutorial that explains how to upgrade PIP in Anaconda.

Finally, if you need to install PIP, you may wanna review the pip documentation.