How to install additional python packages

You may come across a situation where you require additional python packages that are not yet installed. Usually in this situation you could just open a terminal and install the package directly using pip. The jupyter notebook is configured to use a python venv though, so there is an additional step involved.

Enter the venv

To enter the preconfigured virtual environment use the following command from your users home directory

source ~/.ml-venv/bin/activate

Activating venv

Installing a package

Once you entered the venv you can use the usual commands to install a python package. If you wanted to install the nltk package for example you would type:

pip install nltk

Exit venv

Once you are done installing the desired packages you can use

deactivate

to exit the venv. The new packages should now be available in the Jupyter Notebooks after a short reload by pressing the Restart Kernel button next to the Run and Stop buttons.

Written by Tobias Stein