- How to install and use Pip3
- Install Pip3
- Installation Prerequisites
- Pip3 Installation
- Install pip3 Ubuntu and Debian Linux
- Install pip3 Windows
- Add Pip3 to Windows Environment Variables
- Install Pip3 MacOS
- Pip3 and Conda
- A modern solution to Python package management – Try ActiveState’s Platform
- Python Package Management In Action
- Installing pip/setuptools/wheel with Linux Package Managers¶
- Fedora¶
- CentOS/RHEL¶
- openSUSE¶
- Debian/Ubuntu and derivatives¶
- Arch Linux¶
- Table of Contents
- Previous topic
- Next topic
- Navigation
How to install and use Pip3
Pip3 is the official package manager and pip command for Python 3. It enables the installation and management of third party software packages with features and functionality not found in the Python standard library. Pip3 installs packages from PyPI (Python Package Index), but won’t resolve dependencies or help you solve dependency conflicts.
The ActiveState Platform’s command line interface, the State Tool will automatically resolve dependencies for you to ensure your Python environment won’t be corrupted by installing incompatible dependencies. Get started for free by creating an account on the ActiveState Platform or logging in with your GitHub account.
Install Pip3
pip3 is the official package manager and pip command for Python 3. It enables the installation and management of third party software packages with features and functionality not found in the Python standard library. Pip3 installs packages from PyPI (Python Package Index).
Installation Prerequisites
Check if pip3 is already installed by entering the following command in a terminal or command line:
Output should be similar to:
Usage: C:\Python38\python.exe -m pip [options] Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. . .
You can also check to see which version of pip3 is installed by entering:
Output should be similar to:
pip 20.0.2 from C:\Python38\lib\site-packages\pip (python 3.8)
Confirm which version of Python (if any) is installed on your computer by entering:
Output should be similar to:
Pip3 Installation
Python 3.4+ in most operating systems includes pip3 by default. If your python version is less than 3.4, then you should upgrade your Python version which will automatically install pip3.
For example, you can install the latest version of Python from ActiveState (Python 3.9), which includes pip3.
Pip3 Upgrade
In operating system environments that already have Python 3 and pip3 installations, you can upgrade pip3, by entering:
python -m pip3 install --upgrade pip
Pip3 Downgrade
You can downgrade to a previous version of pip3, in case a newer version is causing unexpected compatibility errors. For example, to downgrade to pip3 v19.0 run the following command:
python -m pip3 install pip==19.0
Pip3 Virtualenv and Venv
When pip3 is used in a virtual environment, it will generally install packages in a path similar to:
Pip3 Usage
To install a Python package, enter:
Caution:
Linux and MacOS have system Python, that you should leave alone if possible. System Python is configured to help the operating system work as intended.
Install pip3 Ubuntu and Debian Linux
Ubuntu 18.04 has both Python 2 and Python 3 installed by default, and hence has two pip variants for each Python version. ‘pip’, refers to Python 2. pip3 refers to Python 3.
Ubuntu 20.4 has only Python 3, but still requires a separate python-pip 3 installation.
Procedure for installing pip3 on Ubuntu and Debian Linux:
Enter the following command to update Linux:
Enter the following command to install pip3:
sudo apt install python3-pip
The above command will also install all pip3 dependencies.
To find the location where pip3 installs packages in Ubuntu Linux, enter:
Output should be similar to:
Install pip3 Windows
To install or upgrade pip3 in a Windows environment that already has Python 3 installed:
Download the latest version of get-pip.py from
You can also use the curl command to download get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
CD into the directory where get-pip.py was downloaded to, and enter the following command to install pip3 and its dependencies:
You can verify that pip3 is installed by navigating to the default pip3 installation directory, eg. C:\python38\scripts\, and enter:
Add Pip3 to Windows Environment Variables
A common problem with running Python tools such as pip3 in Windows, is not having it in the environment path so that you can access it from anywhere. In most cases, you can navigate to the default /scripts directory in which the tool is installed in order to run it.
To run pip3 from any location, you need to add the directory in which it is installed in, as a System PATH environment variable:
- Open the Control Panel and navigate to System .
- Click on Advanced system settings in the upper left panel.
- Click o nEnvironment Variables.
- UnderSystem Variables , scroll down then double-click the PATH variable.
- Click New , and add the directory where pip3 is installed,
e.g.C:\Python38\Scripts , and select OK.
Figure 1: Environment Variables: Directory where pip3 is installed:
Install Pip3 MacOS
To install pip3 in a MacOS environment that already has Python 3 installed, enter:
sudo apt install python3-pip
To install pip3 using the Homebrew package manager (if it is installed), enter:
You can also install pip3 using get-pip.py:
- Download the latest version of get-pip.py from https://bootstrap.pypa.io/.
- CD into the download directory, and enter the following command:
sudo python3 get-pip.py
get-pip.py will install pip3 for the python version which runs the script.
Pip3 and Conda
Pip3 has limited use in the Conda environment compared to other operating system environments.
Conda has many of the features found in pip3, but is otherwise a completely separate tool. It installs python modules and packages from the Anaconda Repository. Only after Conda has been used to install as many packages as possible in a project, should pip3 be used to install any remaining software.
It depends on whether you are familiar with pip3 and Conda, and with how package installations interact between the two methods. If you are relatively new to Conda and Python, then only use Conda to install packages in Conda environments. Otherwise pip3 can be used to install packages not found in the Anaconda Repository. Extra care needs to be taken with pip3 dependencies so that they do not conflict with Conda packages and dependencies.
If Python 3 and pip3 are installed outside of the Conda environment, then you can run pip3 from an Anaconda prompt just as you would from a Linux or Windows terminal or command line.
A modern solution to Python package management – Try ActiveState’s Platform
The ActiveState Platform is a cloud-based build tool for Python. It provides build automation and vulnerability remediation for:
- Python language cores, including Python 2.7 and Python 3.5+
- Python packages and their dependencies, including:
- Transitive dependencies (ie., dependencies of dependencies)
- Linked C and Fortran libraries, so you can build data science packages
- Operating system-level dependencies for Windows, Linux, and macOS
- Shared dependencies (ie., OpenSSL)
- Find, fix and automatically rebuild a secure version of Python packages like Django and environments in minutes
Python Package Management In Action
Get a hands-on appreciation for how the ActiveState Platform can help you manage your dependencies for Python environments. Just run the following command to install Python 3.9 and our package manager, the State Tool:
powershell -Command "& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://platform.activestate.com/dl/cli/install.ps1'))) -activate-default ActiveState-Labs/Python-3.9Beta"
Now you can run state install . Learn more about how to use the State Tool to manage your Python environment.
Let us know your experience in the ActiveState Community forum.
Installing pip/setuptools/wheel with Linux Package Managers¶
This section covers how to install pip , setuptools , and wheel using Linux package managers.
If you’re using a Python that was downloaded from python.org, then this section does not apply. See the Requirements for Installing Packages section instead.
Note that it’s common for the versions of pip , setuptools , and wheel supported by a specific Linux Distribution to be outdated by the time it’s released to the public, and updates generally only occur for security reasons, not for feature updates. For certain Distributions, there are additional repositories that can be enabled to provide newer versions. The repositories we know about are explained below.
Also note that it’s somewhat common for Distributions to apply patches for the sake of security and normalization to their own standards. In some cases, this can lead to bugs or unexpected behaviors that vary from the original unpatched versions. When this is known, we will make note of it below.
Fedora¶
sudo dnf install python3-pip python3-wheel
To learn more about Python in Fedora, please visit the official Fedora docs, Python Classroom or Fedora Loves Python.
CentOS/RHEL¶
CentOS and RHEL don’t offer pip or wheel in their core repositories, although setuptools is installed by default.
To install pip and wheel for the system Python, there are two options:
- Enable the EPEL repository using these instructions. On EPEL 7, you can install pip and wheel like so:
sudo dnf install python3-pip python3-wheel
sudo dnf install python3-pip python3-wheel
sudo dnf upgrade python3-setuptools
To install pip, wheel, and setuptools, in a parallel, non-system environment (using yum) then there are two options:
- Use the “Software Collections” feature to enable a parallel collection that includes pip, setuptools, and wheel.
- For Redhat, see here: https://developers.redhat.com/products/softwarecollections/overview
- For CentOS, see here: https://github.com/sclorg
Be aware that collections may not contain the most recent versions.
sudo yum install python34u python34u-wheel
openSUSE¶
sudo zypper install python3-pip python3-setuptools python3-wheel
Debian/Ubuntu and derivatives¶
Firstly, update and refresh repository lists by running this command:
sudo apt update sudo apt install python3-venv python3-pip
Recent Debian/Ubuntu versions have modified pip to use the “User Scheme” by default, which is a significant behavior change that can be surprising to some users.
Arch Linux¶
Currently, there is no “copr” yum plugin available for CentOS/RHEL, so the only option is to manually place the repo files as described.
Table of Contents
- An Overview of Packaging for Python
- The Packaging Flow
- Tutorials
- Guides
- Installing packages using pip and virtual environments
- Installing stand alone command line tools
- Installing pip/setuptools/wheel with Linux Package Managers
- Installing scientific packages
- Package index mirrors and caches
- Hosting your own simple repository
- Packaging and distributing projects
- Including files in source distributions with MANIFEST.in
- Single-sourcing the package version
- Dropping support for older Python versions
- Packaging binary extensions
- Packaging namespace packages
- Creating and discovering plugins
- Using TestPyPI
- Making a PyPI-friendly README
- Publishing package distribution releases using GitHub Actions CI/CD workflows
- Tool recommendations
- Analyzing PyPI package downloads
Previous topic
Next topic
Navigation
© Copyright 2013–2020, PyPA.
This page is licensed under the Python Software Foundation License Version 2.
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.The Python Software Foundation is a non-profit corporation. Please donate.
Last updated on Jun 16, 2023. Found a bug?
Created using Sphinx 4.5.0.