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

Chapter 3: Pip

Installing packages

face Josiah Wang Ivan Procaccini

You will install the following packages to your virtual environment. You will need them anyway for our upcoming lessons!

  1. numpy
  2. scipy
  3. matplotlib
  4. pandas
  5. scikit-learn

Installing a package is as easy as running pip install <package_name>.

For example, pip install numpy will usually install the latest version from PyPI.

You can also install specific versions, e.g. pip install numpy==1.21.3.

You can also install multiple packages in a single line:

(my_env) user@MACHINE:~/ai_project$ pip install numpy scipy matplotlib pandas scikit-learn

Once you are done installing, you can try listing your packages again. You will see the packages installed (along with many other dependencies).

(my_env) user@MACHINE:~/ai_project$ pip list
Package         Version
--------------- -------
cycler          0.11.0
joblib          1.1.0
kiwisolver      1.3.2
matplotlib      3.4.3
numpy           1.21.3
pandas          1.3.4
Pillow          8.4.0
pip             20.0.2
pkg-resources   0.0.0
pyparsing       3.0.4
python-dateutil 2.8.2
pytz            2021.3
scikit-learn    1.0.1
scipy           1.7.1
setuptools      44.0.0
six             1.16.0
threadpoolctl   3.0.0
(my_env) user@MACHINE:~/ai_project$

Uninstalling a package

If you need to uninstall a package, use the uninstall subcommand.

(my_env) user@MACHINE:~/ai_project$ pip uninstall pandas