Skip to content

Installation Instructions

These instructions describe how to set up a working environment for the class. If you run into trouble, raise an issue on the class repository to get help.

Install mamba

mamba is a Python package manager. If you ever used Anaconda: it's got the same interface, but it's much faster: no more 10 minute waits on calculating dependency trees!

You can download the installer shellscript (Linux, macOS) / executable from the conda-forge webpage then run it in a terminal (Linux, macOS):

bash {filename}.sh
or execute it (Windows).

On Windows, you can download the installer executable following the same link then execute it.

In any of the operating systems, we'll interact with mamba via a command line interface, so please open up a terminal.

Create a new environment

Now we'll install packages in an environment. It's important to create a new environment for this as otherwise all new environments will get the packages, which can cause incompatibility issues.

Sometimes, the most recent version of torch does not support the most recent version of python. To be sure, let's check on the python package manager page by following this link

So that we can land on the Moon when we learn about Deep Reinforcement Learning, make sure to create a virtual environment that uses python version 3.13:

mamba create -n {environment name} python=3.13

Warning

Please do not use curly braces {} in the environment name. For example, if the environment name is DL, then you need to run

mamba create -n DL python=3.13

Activate the environment

You only have to install mamba and create a new environment once. On the other hand, any time you want to work in this environment, you need to activate it first. You can do this via

mamba activate {environment name}
It is important to never forget this before installing packages as otherwise you'll install them to the base environment, which can cause incompatibility issues.

Install JupyterLab

We will use the notebook environment JupyterLab to run the lab notebooks. To install it, together with:

  1. the package ipywidgets, that we will need for interactive 3D plots of how a simple neural network processes a toy dataset, and
  2. the package swig, that we will need to land on the Moon with Reinforcement Learning,

run the following command in a terminal:

mamba install -n {environment name} -c conda-forge ipywidgets jupyterlab swig

Install Pytorch

Now you can install PyTorch following its Installation Instructions.

  1. Make sure to choose the OS you're using.
  2. Moreover, if you have an Nvidia GPU, check the CUDA version by typing
    nvidia-smi
    
    in a terminal. In Compute Platform in the installation instructions, choose the CUDA version number that is the largest such that it is at most the CUDA version output by nvidia-smi.
  3. Run the pip command shown in the installation instructions in a terminal. You do not have to install torchvision and torchaudio, so you may leave those out.

Install Additional Packages

Now we'll install the most common additional packages we'll use. More packages may be installed as we go along the course. Please run the following in a terminal:

pip install "datasets<4" "gymnasium[box2d,toy_text]" matplotlib mosestokenizer moviepy pandas pillow scipy scikit-learn seaborn tqdm

Running the Notebooks

After installation, you can view the notebooks on Jupyter Lab, which you can start in a browser tab by typing

jupyter lab
in a terminal, or a coding IDE (Integrated Development Environment) such as VS Code. Note that the latter may not work in some configurations; in that case, try Jupyter Lab.