How to check pip version
How to check pip version
Python PIP
What is PIP?
PIP is a package manager for Python packages, or modules if you like.
Note: If you have Python version 3.4 or later, PIP is included by default.
What is a Package?
A package contains all the files you need for a module.
Modules are Python code libraries you can include in your project.
Check if PIP is Installed
Navigate your command line to the location of Python’s script directory, and type the following:
Example
Check PIP version:
Install PIP
If you do not have PIP installed, you can download and install it from this page: https://pypi.org/project/pip/
Download a Package
Downloading a package is very easy.
Open the command line interface and tell PIP to download the package you want.
Navigate your command line to the location of Python’s script directory, and type the following:
Example
Download a package named «camelcase»:
Now you have downloaded and installed your first package!
Using a Package
Once the package is installed, it is ready to use.
Import the «camelcase» package into your project.
Example
Import and use «camelcase»:
txt = «hello world»
Find Packages
Remove a Package
Use the uninstall command to remove a package:
Example
Uninstall the package named «camelcase»:
The PIP Package Manager will ask you to confirm that you want to remove the camelcase package:
Press y and the package will be removed.
List Packages
Use the list command to list all the packages installed on your system:
Example
List installed packages:
We just launched
W3Schools videos
COLOR PICKER
Get certified
by completing
a course today!
CODE GAME
Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Thank You For Helping Us!
Your message has been sent to W3Schools.
Top Tutorials
Top References
Top Examples
Web Courses
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.
Find which version of package is installed with pip
Using pip, is it possible to figure out which version of a package is currently installed?
16 Answers 16
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
As of pip 1.3, there is a pip show command.
In older versions, pip freeze and grep should do the job nicely.
I just sent a pull request in pip with the enhancement Hugo Tavares said:
(specloud as example)
Pip 1.3 now also has a list command:
So combining with AdamKG ‘s answer :
You can use the grep command to find out.
will show only the versions.
The python function returning just the package version in a machine-readable format:
Prior to python 3.8:
Note that while invoking pip freeze in bash version may seem inefficient, only this method proves to be sufficiently robust to package naming peculiarities and inconsistencies (e.g. underscores vs dashes, small vs large caps, and abbreviations such as sklearn vs scikit-learn ).
One such problem arises when there are other versions of the package hidden in a user site-packages subfolder. As an illustration of the perils of using version() here’s a situation I encountered:
Another problem is having some conda-installed packages in the same environment. If they share dependencies with your pip-installed packages, and versions of these dependencies differ, you may get downgrades of your pip-installed dependencies.
To illustrate, the latest version of numpy available in PyPI on 04-01-2020 was 1.18.0, while at the same time Anaconda’s conda-forge channel had only 1.17.3 version on numpy as their latest. So when you installed a basemap package with conda (as second), your previously pip-installed numpy would get downgraded by conda to 1.17.3, and version 1.18.0 would become unavailable to the import function. In this case version() would be right, and pip freeze / conda list wrong:
How To Install PIP to Manage Python Packages On Windows
Home » DevOps and Development » How To Install PIP to Manage Python Packages On Windows
PIP is a package management system used to install and manage software packages written in Python. It stands for “preferred installer program” or “Pip Installs Packages.”
PIP for Python is a utility to manage PyPI package installations from the command line.
If you are using an older version of Python on Windows, you may need to install PIP. You can easily install PIP on Windows by downloading the installation package, opening the command line, and launching the installer.
This tutorial will show how to install PIP on Windows, check its version, upgrade, and configure.
Note: The latest versions of Python come with PIP pre-installed, but older versions require manual installation. The following guide is for version 3.4 and above. If you are using an older version of Python, you can upgrade Python via the Python website.
Before you start: Check if PIP is Already Installed
PIP is automatically installed with Python 2.7.9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.
Before you install PIP on Windows, check if PIP is already installed.
1. Launch the command prompt window:
Alternatively, type cmd in the Windows search bar and click the “Command Prompt” icon.
2. Type in the following command at the command prompt:
If PIP responds, then PIP is installed. Otherwise, there will be an error saying the program could not be found.
Installing PIP On Windows
Follow the steps outlined below to install PIP on Windows.
Step 1: Download PIP get-pip.py
Before installing PIP, download the get-pip.py file.
1. Launch a command prompt if it isn’t already open. To do so, open the Windows search bar, type cmd and click on the icon.
2. Then, run the following command to download the get-pip.py file:
Step 2: Installing PIP on Windows
To install PIP type in the following:
If the file isn’t found, double-check the path to the folder where you saved the file. You can view the contents of your current directory using the following command:
The dir command returns a full listing of the contents of a directory.
Step 3: Verify Installation
Once you’ve installed PIP, you can test whether the installation has been successful by typing the following:
If you receive an error, repeat the installation process.
Step 4: Add Pip to Windows Environment Variables
To run PIP from any location, you need to add it to Windows environment variables to avoid getting the «not on PATH» error. To do so, follow the steps outlined below:
Step 5: Configuration
In Windows, the PIP configuration file is %HOME%\pip\pip.ini.
Upgrading PIP for Python on Windows
New versions of PIP are released occasionally. These versions may improve the functionality or be obligatory for security purposes.
To check the current version of PIP, run:
To upgrade PIP on Windows, enter the following in the command prompt:
This command uninstalls the old version of PIP and then installs the most current version of PIP.
Downgrade PIP Version
Downgrading may be necessary if a new version of PIP starts performing undesirably. To downgrade PIP to a prior version, specifying the version you want.
To downgrade PIP, use the syntax:
For example, to downgrade to version 18.1, you would run:
You should now see the version of PIP that you specified.
Note: Learn how to update packages using winget upgrade command.
Congratulations, you have installed PIP for Python on Windows. Check out our other guides to learn how to install PIP on other operating systems:
Now that you have PIP up and running, you are ready to manage your Python packages.
NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices. Check out our guide and learn how to install NumPy using PIP.
Python Check Version of Package with pip
Table of Contents
Problem Formulation
Assuming you have the Python package manager pip installed in your operating system (Windows, Linux, macOS).
Method 1: pip show
To check which version of a given package is installed, use the pip show command. For example, to check the version of your NumPy installation or virtual environment, run pip show numpy in your command line or Powershell (Windows), or terminal (macOS and Linux/Ubuntu).
This will work if your pip installation is version 1.3 or higher—which is likely to hold in your case because pip 1.3 was released a decade ago in 2013!!
Here’s an example in my Windows Powershell, I’ve highlighted the line that shows that my package version is 1.21.0:
In some instances, this will not work—depending on your environment. In this case, try those commands before giving up:
Of course, replace “ numpy ” with your particular package name.
Method 2: pip list
To check the versions of all installed packages, use the pip list command. You can then locate the version of your particular package in the resulting output. The fact that the output packages are sorted alphabetically may find to locate the particular package.
This will work if your pip installation is version 1.3 or higher.
Here’s an example in my Windows Powershell, I’ve highlighted the line that shows that my package version is 1.21.0:
In some instances, this will not work—depending on your environment. Then try those commands before giving up:
Method 3: Check Package Version in Your Python Script
Method 4: importlib.metadata.version
A more general way to check the package version in your Python script is provided by the importlib.metadata package in the form of a version(your_package_name_string) function. Calling it will return a string representation of the specific version. For example, importlib.metadata.version(‘numpy’) returns the version 1.21.0 in my current Windows environment.
Summary
In this article, we’ve studied four ways to check the package version using pip :
Thanks for giving us your valued attention — we’re grateful to have you here! 🙂
Where to Go From Here?
Enough theory. Let’s get some practice!
Coders get paid six figures and more because they can solve problems more effectively using machine intelligence and automation.
To become more successful in coding, solve more real problems for real people. That’s how you polish the skills you really need in practice. After all, what’s the use of learning theory that nobody ever needs?
You build high-value coding skills by working on practical coding projects!
Do you want to stop learning with toy projects and focus on practical code projects that earn you money and solve real problems for people?
🚀 If your answer is YES!, consider becoming a Python freelance developer! It’s the best way of approaching the task of improving your Python skills—even if you are a complete beginner.
If you just want to learn about the freelancing opportunity, feel free to watch my free webinar “How to Build Your High-Income Skill Python” and learn how I grew my coding business online and how you can, too—from the comfort of your own home.
Programming Humor – Python
While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com. He’s author of the popular programming book Python One-Liners (NoStarch 2020), coauthor of the Coffee Break Python series of self-published books, computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.
How to Upgrade PIP in Windows
In this short tutorial, you’ll see the full steps to upgrade PIP in Windows from scratch.
Here are the topics to be reviewed:
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 you’ll see the full steps to upgrade pip in the next section.
Steps to upgrade PIP in Windows
(1) First, type Command Prompt in the Windows search box
(2) Next, open the Command Prompt, and you’ll see the following screen with your user name (to avoid any permission issues, you may consider to run the Command Prompt as an administrator ):
(3) In the Command Prompt, type “cd\” to ensure that your starting point has only the drive name:
(4) Press Enter, and you’ll see the drive name C:\>
(5) Locate your Python application path, which is the folder where you originally installed Python.
Here is an example of a Python application path:
C:\Users\Ron\AppData\Local\Programs\Python\Python39
(6) Once you retrieved the Python application path, type the following command in the Command Prompt:
“cd” followed by your Python application path
For our example:
(7) Press Enter, and you’ll see:
(8) To upgrade PIP, type/copy this command, and then press Enter:
This is how the command would look like in the Command Prompt:
(9) You’ll notice that the latest version of PIP would be installed:
Steps to check the version of PIP in Windows
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:
(2) Then, locate your Python Scripts path. The Scripts folder should be located within the Python application path.
For our example, the Python Scripts path is:
C:\Users\Ron\AppData\Local\Programs\Python\Python39\Scripts
(3) Type “cd” followed by the Python Scripts path (then press Enter):
(4) Finally, type the following command to check the version of PIP:
For our example:
(5) Press Enter, and you’ll see the PIP version:
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..” (and then press Enter), and you would revert back to the Python application path:
(2) Let’s say that you want to downgrade the PIP version to 18.1
To do that, simply type the following command, and then press Enter:
(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.