How to Install Pip on Windows

How to Install Pip on Windows
Pip is the standard package manager for Python. It enables the installation and management of third party packages that provide features and functionality not contained in the Python standard library. Newer versions of Python (Python 2 >= v2.7.9 or Python 3 >= v3.4) come prepackaged with pip by default. Pip is also included in the virtual environments created by virtualenv and pyvenv.
But if you’re using an older version of Python, pip will need to be manually installed. This tutorial steps through how to install Pip on Windows, and explains how to keep it updated.

Prerequisites for Pip Installation

  1. Check if pip is already installed by running the following on the command line:
pip --version

or

pip -V

If pip is installed, you’ll see something similar to the following output:

C:usersjdoe>pip --version
Pip 19.2.3 from c:usersjdoeappdatalocalprogramspythonpython38-32libsite-packagespip (python 3.8)
  1. Verify that Python is installed. If pip is not installed, you can confirm that Python is available on your local machine and determine the version by running the following command:
python --version

You should see something like the following if Python is installed:

C:usersjdoe>pip --versionPython 3.8.0

If you do not have a version of Python installed, you can quickly download and install a recent version of ActivePython.

How to Install Pip with get-pip.py  

  1. To manually install pip on Windows, you will need a copy of get-pip.py.  For older Python versions, you may need to use the appropriate version of the file from pypa.org. Download the file to a folder on your computer, or use the curl command:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  1. Next, run the following command to install pip:
python get-pip.py

If the file is not found, you may need to first navigate to the directory containing the  get-pip.py file. On installation, you should see something similar to the following:

Installing collected packages: pip, setuptools, wheel
The script wheel.exe is installed in ‘C:Python33Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-10.0.1 setuptools-39.2.0 wheel-0.29.0

This command will also install setuptools and wheel if they are not already installed. Setuptools is a suite of configuration enhancements to the Python distutils that facilitates building Python distributions. It is required to install source distributions, or “sdists,” a distribution format that provides the metadata and source files needed for tools like pip.

  1. Verify that pip is installed by running the previous command to check the version. Navigate to the installation location (C:Python33Scripts by default) and run:
pip --version

For further instructions on how to install packages with pip, refer to our guide to Python Package Installation on Windows

Adding PIP to Windows Environment Variables

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you’re trying to run in your current directory. In most cases, you’ll need to navigate to the directory in which the tool is installed before you can run the command to launch it.
If you’d rather run pip (or other tools) from any location, you’ll need to add the directory in which it’s installed as a PATH environment variable by doing the following:  

  1. Open up the Control Panel and navigate to System and Security > System
  2. Click on the Advanced system settings link on the left panel
  3. Click Environment Variables.
  4. Under System Variables, double-click the variable PATH.
  5. Click New, and add the directory where pip is installed, e.g. C:Python33Scripts, and select OK.

How to Install Pip on Windows Environment Variables

Upgrading Pip on Windows

Pip is a key tool in the Python ecosystem, and as such is updated on a regular basis. Changes can always be found in the release notes for each version. In order to keep your version of pip up to date, you can run the following on the command line:

python -m pip install -U pip

This command will uninstall the outdated version of pip first, and then download the most current iteration.
It’s also possible to downgrade to a previous version of pip, in case a newer version is causing unexpected compatibility errors. For example, to downgrade to pip v18.0 run the following command:

python -m pip install pip==18.0

Next Steps

Try the ActiveState Platform to build Python packages faster and safer. Create a custom Python runtime for your next project. Pick just the packages you need, and we’ll automatically resolve all dependencies, build it (including C code) and package it for your platform.


How ActiveState Can Help

ActiveState provides a unified cross-platform toolchain for modern Python package management. It can replace the complex and hard-to-maintain in-house solutions built from multiple package managers, environment management tools and other solutions.
By adopting the ActiveState Platform, developers can:

  • Automated building of packages from source, including link C libraries without the need for a local build environment.
  • Automated resolution of dependencies (or suggestions on how to manually resolve conflicts), ensuring that your environment always contains a set of known good dependencies that work together.
  • Central management of a single source of truth for your environment that can be deployed with a single command to all development and CI/CD environments, ensuring consistent reproducibility.
  • Automated installation of virtual Python environments on Windows or Linux without requiring prior setup.
  • The ability to find, fix and automatically rebuild vulnerable environments, thereby enhancing security and dramatically reducing time and effort involved in resolving CVEs.
  • Visually seeing which versions of which packages are approved for use, thereby taking the guesswork out of development.

Those that prefer to work from the command line can leverage the ActiveState Platform’s CLI, the State Tool, which acts as a universal package manager for Python, and provides access to most of the features offered by the Platform.

Python Package management

 
 
 
 
 
 
 
 
 
 

Modern Python Package Management

ActiveState provides a unified cross-platform toolchain for modern Python package management. It can replace the complex and hard-to-maintain in-house solutions built from multiple package managers, environment management tools and other solutions.
By adopting the ActiveState Platform, developers can:

  • Increase the security of Python environments
  • Improve the transparency of your open source supply chain
  • Dramatically reduce package and environment management overhead
  • Eliminate dependency hell
  • Reduce “works on my machine” issues

Ultimately, developers that are willing to adopt the ActiveState Platform will spend less time wrestling with tooling and more time focused on doing what they do best: coding.
To try the ActiveState Platform for yourself, sign-up for a free account.

Related Links

Frequently Asked Questions

Why is pip install not working?

If pip is not working on Windows, it’s probably because it hasn’t been installed as a PATH environment variable. You can either:

    1. Navigate to the directory in which pip is installed before running it, or
    2. Add the directory in which pip is installed as a PATH environment variable by doing the following:
      • Open up the Control Panel and navigate to System and Security -> System
      • Click on the Advanced system settings link on the left panel
      • Click Environment Variables
      • Under System Variables, double-click the variable PATH
      • Click New, and add the directory where pip is installed, such as C:\Python\Scripts, and select OK.

Learn more about Python package installation on Windows.

How do I install pip on Windows?

Pip is installed by default with most Python distributions, but to install pip on Windows you have two options:

  1. Install a Python distribution like ActivePython, which includes pip, or
  2. Manually install pip with get-pip.py:
    • Download get-pip.py
    • Navigate to the directory where you installed get-pip.py
    • Run the following command: python get-pip.py

For further instructions, see Python Package Installation on Windows.

How do I install the pip package manager on Windows 10?

Pip is installed by default with most Python distributions, but to install pip on Windows you have two options:

  1. Install a Python distribution like ActivePython, which includes pip, or
  2. Manually install pip with get-pip.py:
    • Download get-pip.py
    • Navigate to the directory where you installed get-pip.py
    • Run the following command: python get-pip.py
How do I know if pip is installed?
Verify that pip is installed by running the previous command to check the version. Navigate to the installation location (C:Python33Scripts by default) and run:
pip --version
See Python Package Installation on Windows for more information.

Recent Posts

Tech Debt Best Practices: Minimizing Opportunity Cost & Security Risk

Tech debt is an unavoidable consequence of modern application development, leading to security and performance concerns as older open-source codebases become more vulnerable and outdated. Unfortunately, the opportunity cost of an upgrade often means organizations are left to manage growing risk the best they can. But it doesn’t have to be this way.

Read More
Scroll to Top