Install Python#
To start this lab, we will need to install a Python distribution with the necessary packages. We recommend using conda
, an open-source package management system which can be installed using Miniconda (a lightweight version of Anaconda).
Miniconda#
The latest version of Miniconda can be accessed from the dowload page. Scroll down a bit and download the appropriate Miniconda package for your operating system.
Test installation#
After installation is complete, we can test that the package manager conda
works by opening an Anaconda Prompt (miniconda3) (Windows) or Terminal (Mac).
In the command prompt (or Terminal) run the following:
conda --version
If the command returns a version number of conda (e.g. conda 4.11.0
) everything is working correctly.
Create course environment#
The Python libraries needed for this course can be installed using an environment.yml
file which can be downloaded from here.
We can install environment.yml
by opening an Anaconda Prompt (miniconda3) (Windows) or Terminal (Mac), navigating to the file (i.e. cd Downloads/
) and running the following command:
conda env create -f environment.yml
This may take some time so we recommend reading through the other lab materials while the packages are installing. But, if all goes well, we will have a new environment called rs
. To activate this environment, type:
conda activate rs
Jupyter Lab#
Now launch JupyterLab
by typing:
jupyter lab
Once launched, we can open a new Jupyter Notebook by clicking Python 3 (ipykernel)
button.

Check everything is working#
We can make sure that the environment.yml
file installed correctly by copying and pasting the code below into the first cell of your Jupyter Notebook.
import numpy as np
c = np.add(2,3)
c
5
Run the cells by pressing Shift + Enter. If everything is working correctly, this code block should return the number 5
.
Save assignment#
Save the notebook by clicking File → Save Notebook As… and naming the file something like assignment-x.ipynb
, where x
stands for the assignment number.
Submit assignment#
This can be a little tricky. We recommend using ctrl + p (or command + p) → Save as PDF. You could also download the notebook by clicking File → Save and Export Notebook As → PDF but you may need to install some other packages.
When you are finished with the assignment, the .pdf
file should be moved to your local course folder and submitted via Canvas.
JupyterLab#
These instructions are just the absolute basics. For more information about JupyterLab, we suggest referring to their docs. The following pages are particularly relevant: