This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 3: Pip

Pip

face Josiah Wang Ivan Procaccini

You can now install packages to the virtual environment you set up. I will assume you are working in a virtual environment, although you can similarly install packages to your main Python installation.

Introducing Pip

You will usually use Pip to install external Python packages.

Pip (a recursive acronym for “Pip Installs Packages”) is the package installer for Python, officially endorsed and recommended by the Python Package Authority (PyPA). It fetches and installs any package on the Python Package Index (PyPI). This can be from the source code or from standard Python binaries called wheel.

Pip comes with Python. When you create a virtual environment, pip can also be found in your virtual environment directory (my_env/bin or my_env\Script in our example earlier). Running pip will install any packages to your currently activated virtual environment.

After you create a virtual environment, you usually want to ensure you are using the latest version of pip:

(my_env) user@MACHINE:~/ai_project$ pip install --upgrade pip

Listing installed packages

To see what packages are installed in your currently active virtual environment, use pip list.

(my_env) user@MACHINE:~/ai_project$ pip list
Package       Version
------------- -------
pip           20.0.2
pkg-resources 0.0.0
setuptools    44.0.0
(my_env) user@MACHINE:~/ai_project$

Very clean installation. Not much installed so far. Let’s change that in the next page!