Installing JupyterLab (all platforms)#

This chapter contains the instructions about how to install additional useful tools which will enhance your python installation a great deal!

Note

Installing JupyterLab and the python packages need to be done only once on the computer you are using! If you are using a workstation in a lab, you will have to do it again if you change for another workstation or if the workstation is reset.

Prerequisites#

I’ll assume that the python installation instructions have worked for you (or that you are using a university workstation), and that you:

  • are able to start a miniforge prompt

  • can type mamba list successfully (conda list on the university’s workstations)

  • can type python and open a python interpreter.

For a primer on the different prompts and interpreters, see my beginners’ programming class notes

Installation instructions#

Open a miniforge prompt (or a terminal on Linux/macOS) and type:

conda create --name qcr --channel conda-forge python=3.12 jupyterlab numpy scipy matplotlib xarray netcdf4 cartopy cftime geopandas seaborn rioxarray
mamba create --name qcr --channel conda-forge jupyterlab numpy scipy matplotlib xarray netcdf4 cartopy cftime geopandas seaborn rioxarray

This will install jupyter-lab and all the packages at the same time. Say “yes” to the install question. To check if it worked, type ipython in the terminal, which should display something like:

Python 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:15:42) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.1.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]:

The only visual difference between the ipython and python interpreters is that >>> has been replaced by In [1]:. More on this in class if you are interested.

Exit ipython (remember how? Use exit()) and move on to the next step.

Note

The packages cftime, geopandas and rioxarray have been added as a requirement for Workshop 7. To install them in an existing qcr environment, start by activating the environment with conda activate qcr and then type mamba install --channel conda-forge cftime geopandas rioxarray or, if mamba is not available, conda install --channel conda-forge cftime geopandas rioxarray.

Opening JupyterLab in the qcr environment and folder#

Note

This needs to be done every time you want to work on your notebooks!

From now on, and regardless of the computer you are using, you will have to activate the qcr environment before starting jupyter-lab. I strongly recommend to start jupyter-lab from the folder where you want to work (i.e. where you have saved your notebooks and data).

The steps are as follows:

  1. Open a miniforge prompt (or a terminal on Linux/macOS)

  2. Navigate to the folder where you want to work by typing:

    cd C:\path\to\folder
    

    I recommend copying the path from the file explorer - see video below for an example.

  3. Activate the qcr environment by typing:

    conda activate qcr
    
  4. Start jupyter-lab by typing:

    jupyter-lab
    

This is best explained with a simple video:

If you are new to JupyterLab, ou can watch this video on my beginners class.

Learning checklist#