JupyterLab

Overview

JupyterLab is Project Jupyter's web-based development interface for Jupyter Notebooks. On Nova, it is available as an app available through Open OnDemand instance of the respective cluster. 

Return to Table of Contents

Table of Contents

Accessing JupyterLab

Start by logging in to Nova OnDemand.   Then, from the OnDemand main menu, select Interactive Apps->Jupyter:

select jupyter from ondemand

Configuring Your Jupyter Session

After selecting Interactive Apps->Jupyter, you will open the form show below to configure the hardware resources and other job details you want your Jupyter session to have.  The most important parameters to pay attention to are:

  • Number of Tasks Per Node - If you will not be using a GPU, you can choose up to 32 regular CPUs for this session.  If you are planning to use a GPU (see also the GRES field), then choose no more than 6 CPUs per GPU.  
  • GRES (only if requesting a GPU, leave blank otherwise).
  • Memory required -  A starting point is 5GB per CPU.   (16 CPUs =  80GB memory)
  • Work Directory -  If you are in a research group use a path under your group's  /work or /ptmp directory.  You/ptmp, or /classtmp folders.   


configure jupyter session form 1

configure jupyter session form 2

 

After you've entered the desired values, click the Launch button.  OnDemand will prepare the Jupyter instance on a compute node.  This usually takes less than 10 seconds.   When the Jupyter session is ready for you to connect, the Interactive Sessions page will have an entry like:

Click the Connect to Jupyter button to connect.

Return to Table of Content

Launch a Jupyter Notebook

To launch a new Python 3 Notebook click File > New > Notebook and select Python 3 for the kernel. 

Image showing File > New > Notebook

This will open a new Jupyter Notebook tab. 

Another method to launch a Jupyter Notebook is via the JupyterLab Launcher. The launcher will show available environments to launch a Notebook with. To open the Launcher, click File > New Launcher. From the Launcher tab, choose the Notebook environment to launch. 

Image showing File > New Launcher and the environments

Return to Table of Contents

Using Python Environments in a Jupyter Notebook

Virtual environments can be used with JupyterLab to allow preconfigured environments.

Click here for instructions for using Python Virtual Environments
Click here for instructions for using Micromamba Virtual Environments

Return to Table of Contents

Using Shell and Magic Commands in a Jupyter Notebook

The IPython kernel can be used to run shell commands as well as Python code. To run a shell command, put an exclamation point before the command. (!)  For example, to see the current Slurm jobs you can do:

!squeue -u ${USER}

Some commands will not work the desired way. For example, running a !cd command will not change the work directory of the environment. To do that, a magic command has to be issued. Magic commands begin with a percent sign. (%) Running the following command would change the environments working directory. 

 %cd /home/user1/some/directory

For a listing of available built-in magic commands, see the IPython magic command guide