In this tutorial, we will learn how to upgrade pip. This may be handy, if we, for instance, are working with old Python environments, This, in turn, may lead to that we need to upgrade pip to the latest version.
In this post, we will use pip, conda (Anacondas package manager), and Anaconda Navigator to upgrade pip.
How to Upgrade Pip
In this section, we will learn how to get the latest version of pip using the three previously mentioned methods. Moreover, in the first subsections, we are going to use Windows Command Prompt as well as pip. Of course, we could also use Windows PowerShell to run the commands we need to upgrade pip. Find out how to open the command prompt here.
How to Check Pip Version
First, before learning how to upgrade pip we are going to answer the question “what version of pip do I have?” Now, to get the output, as in the image above, we can start up the Windows Command Prompt and type
pip --version. In the Python environment, we have pip 19.2.3 installed. Note, a step-by-step guide will show how to open Windows Command prompt.
Update pip Using pip
Now, we are going to answer the question “how to update Python pip?” and we are going to start by using pip to update pip. To upgrade pip, we open up the command prompt and type the following code:
pip install --upgrade pip
If we now type
pip --version again we will see that we have the latest version of pip installed:
3 Steps to Upgrade Pip using Pip
Now, here’s a more detailed description of how to upgrade pip using pip. In the first step, we are going to open up the command prompt:
1) Open the command prompt
In the search box, to the bottom left, type “Command Prompt”.
Note, if you are using Linux you should, of course, start up your favorite window manager instead. However, the next steps for upgrading pip are basically the same anyway.
2) Right-click on the Command Prompt app
The next thing we are going to do is to click on the command prompt app. We make sure to right-click on it and run it as administrator. This way we’ll avoid any permission issues.
Obviously, if you are using linux you don’t have to right-click on the terminal window: just open it up and go to step 3).
3) Upgrade pip
Now, that we the command prompt up and running we are ready to update pip. In this example, we are going to upgrade pip using pip:
pip install --upgrade pip
That was it, now you should have upgraded pip to the latest version. In the next section, you will learn how to do the same procedure but using the package manager conda.
Upgrade Pip using Conda
In this section, we are going to learn how to upgrade pip using conda package manager. This may come in handy as many of us have installed Python using the scientific Python distribution Anaconda. That is, here we find the answer to the question “How do I upgrade PIP on Anaconda prompt?” Now, we are going to update pip by using three simple steps.
How do I upgrade PIP on Anaconda?
1) Search for the Anaconda Prompt.
First, before running conda to update pip we are going to start the Anaconda Prompt. Type “Anaconda Prompt” in the search box, down to the left in Windows 10.
2) Open the Anaconda Prompt.
Second, we are going to click on the icon for the Anaconda Prompt and run it as administrator (right-click).
3) Upgrade pip!
Finally, we can update pip using conda. Now, this is very simple; all we need to do is write the following command to update pip:
conda upgrade -c anaconda pip.
How do you update PIP?
If we want to update pip, we can do so either by using pip, conda package manager, or Anaconda. For instance, if we you use pip to upgrade pip this is how to do it:
pip install --upgrade pip.
That was it, now we know how to upgrade pip without using pip! It was easy. Note, if your Anaconda Python distribution is in the system path, we could also have updated pip by opening the Windows Command Prompt and using the same commands as above.
Upgrade Pip Using Anaconda Navigator
In this final section, we are going to learn how to update pip using Anaconda Navigator. Using this method to upgrade pip is good if we don’t want to use the command prompt but rather use a GUI.
First, we start up the Anaconda Navigator. It can be done by typing “Anaconda Navigator” in the search box, in the lower-left corner (see the examples above). We just need to click on “Environments” on the left part of Anaconda Navigator. After this, we can scroll down to find pip:
Second, when we have found pip we click on the green check-mark as we can see that there is an update available for pip:
Third, after we have clicked on the green mark we will get a drop-down menu. Obviously, as we are going to upgrade pip we will choose “Mark for update”:
Finally, we are ready to update pip using Anaconda Navigator. In the bottom right corner, there will now be to buttons. We are going to press the green button with the text “Apply”:
Voila! The package pip, or any other Python package, should now be upgraded to the latest version! Updating pip using Anaconda Navigator was quite easy as well.
Many times we need to upgrade Python packages and this can, of course, be done using both pip and conda. Check out the recent post about upgrading Python packages.
In this post, we have learned how to upgrade pip to the latest version. The examples, on how to update Pip, were conducted under Windows 10. However, as pip (and conda) has the same functionality on Linux machines we could probably use them as well (e.g., using the sudo command). In conclusion, we have learned how to update pip using pip, using conda (i.e., Anaconda Prompt), and Anaconda Navigator.