How-to articles, tricks, and solutions about PIP

'pip' is not recognized as an internal or external command

This error message typically occurs when the command prompt or terminal is not able to find the pip executable.

error: Unable to find vcvarsall.bat

The error: Unable to find vcvarsall.bat message is usually raised when you are trying to install a Python package that requires a C compiler, and the compiler is not installed or cannot be found by Python.

Find which version of package is installed with pip

You can use the following command to check the version of a package installed with pip:

How can I install packages using pip according to the requirements.txt file from a local directory?

To install packages using pip from a local directory, you can use the -r option to specify the path to the requirements.txt file.

How do I get a list of locally installed Python modules?

You can use the pip module to get a list of locally installed Python modules.

How do I install a Python package with a .whl file?

To install a Python package with a .whl file, you can use the pip command.

How do I install pip on macOS or OS X?

To install pip on macOS or OS X, you need to use the Terminal.

How do I update/upgrade pip itself from inside my virtual environment?

To update pip itself from inside your virtual environment, you can use the following command:

How to install pip with Python 3?

To install pip with Python 3, you can use the following command:

How to upgrade all Python packages with pip?

You can use the pip freeze command to generate a requirements file that includes all of the current packages and their versions, and then use pip install -r to upgrade all packages to the latest available versions.

ImportError: No module named pip

Here is a code snippet that demonstrates how to handle the "No module named pip" error:

Installing specific package version with pip

To install a specific version of a package with pip, you can use the pip install command followed by the package name and the desired version number.

pg_config executable not found

Check the location of pg_config: Open a terminal and run the command "which pg_config".

pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)"

This error message occurs when pip is unable to verify the certificate of the website it is trying to connect to.

pip install from git repo branch

You can use pip to install a package from a git repository and specify a branch by using the following syntax:

pip install mysql-python fails with EnvironmentError: mysql_config not found

This error occurs when the mysql-config command is not in the system's PATH.

pip uses incorrect cached package version, instead of the user-specified version

Here is an example of how to use pip to install a specific version of a package, rather than using a cached version:

What is the easiest way to remove all packages installed by pip?

The easiest way to remove all packages installed by pip is to use the command pip freeze to get a list of all installed packages, and then pipe that list to pip uninstall -y, like this:

Why use pip over easy_install?

Pip is generally preferred over easy_install because it offers a number of features that easy_install does not, including better package management and more user-friendly command options.