Interactive Jupyter Lab/NoteBook
Before start filling the form, it’ss highly recommended to read the documentation available at the following link → Anaconda Virtual Environments since the Jupyter Lab/Notebook is launched using the anaconda virtual environments. |
Opening Jupyter Form
-
The first step is to select the
Interactive apps
and then click theJupyter Lab/NoteBook
Server in the Open OnDemand dashboard. -
Then you will see a form which needs to be filled to launch the Jupyter Lab/NoteBook on compute nodes.

Partition
-
Partitions are work queues that has computational nodes in it to run the jobs. The partitions available in Discovery are
interactive
,normal
,gpu
,backfill
,class
,epscor
,iiplab
,cfdlab
, so on. -
However, you will see only the list of authorized partitions available for your Discovery account and hence, you won’t see the partitions which you don’t have authorization in the select dropdown.
-
Select one of the partitions where you want to submit your job. Refer to the page → Partitions in Discovery to select the ideal partition for your job.
-
By Default, partition is set to
interactive
.
Walltime(Hours)
-
Sets the Walltime for your job. The job gets killed if the Walltime you set gets elapsed.
Parameter #Hours Min Limit
1 hour
Max Limit
24 hours
Default
1 hour
CPUs(Threads)
-
Sets the Number of CPUs(Threads) for the job. The below table shows the maximum limit for CPU threads for each partition. The default and minimum value is 1 CPU thread.
Partition Max Limit interactive
16
normal
44
gpu
28
epscor
124
iiplab
52
cfdlab
52
class
60
Memory (GB/Gigabytes)
-
Sets the memory for the job in terms of GB. The memory you select is available to all assigned threads for the job. The below table shows the maximum memory limit for each partition which can be requested for the job. The default and minimum value is 1 GB.
Partition | Max Memory Limit(GB) |
---|---|
interactive |
64 |
normal |
240 |
gpu |
50 |
epscor |
3000 |
iiplab |
175 |
cfdlab |
175 |
class |
490 |
GPUs
-
To enable the GPU selection, you need to choose one of the following partitions:
interactive
,class
,gpu
,epscor
,iiplab
,cfdlab
. Only these partitions have GPUs and if you select any of the partitions, you can see theGPUs
dropdown enabled.Parameter #GPU Min Limit
0
Max Limit
2
Partition normal don’t have GPUs. |
Email Address
-
If you want to get notified via email when the job starts/fails/ends, enter the email address associated with the Discovery account.
-
You can leave the text field
blank
if you don’t want job notifications.
Working Directory

If left empty, the working directory points to your /home directory by default. To switch to scratch/project directories, click the Select Project Directory button.

Select the desired directory you want to work with. After you make the selection, the Working Directory for the interactive job gets updated.

Advanced Settings
-
Select the checkbox if you want to choose advanced settings like Anaconda Version, User Interface and Setup Commands(bash syntax).
-
If you don’t specify any advanced settings, Jupyter Lab will be launched using base environment from anaconda3 by default.
Anaconda Version
-
JupyterLab/NoteBook is launched using the Anaconda environment. Anaconda environment conveniently installs the Python, Jupyter Lab/NoteBook, and other commonly used packages for scientific computing and data science.
-
You can choose one of the versions
Anaconda3
orAnaconda2
orMiniforge
. By Default,Anaconda3
is selected.
User Interface
-
Jupyter Lab and Jupyter NoteBook interfaces are available and select one for the interactive job.
Setup Commands(bash syntax)
You can use the text entry box to enter setup commands for the Jupyter server which will run before the server gets launched. Some useful setup commands are,
-
If you want to use your own custom environment for anaconda instead of the default anaconda environment(base), activate the custom environment by running the following command,
Syntax:
conda activate <env-name>
| conda activate /path/to/env
-
While using custom environment, make sure that JupyterLab conda package is installed in your environment. Else, Jupyter Lab/NoteBook won’t be launched.
-
If you don’t activate any custom environment or left the text box blank, then the base enviornment gets activated by default and the base environment has the JupyterLab conda package installed in it already.
-
For more information about anaconda virtual environments and how to create custom environments, install packages in custom environments, refer to the page → Anaconda Virtual Environments in Discovery.
To load additional modules, use the module load command to load into your working environment.
module load <software-name>
For more information about module load command , refer to the page → Module Load in Discovery.
You can also source a bash script which will read and execute commands from the file specified as its argument. Create a bash script called setup-env.sh
#!/usr/bin/env bash
module load anaconda
conda activate <env-name>
To run the bash script file setup-env.sh
using the source
command, run the following command,
source setup-env.sh
Output
(<env-name>) [<username>@discovery-l2 sample-scripts]$
From the above output, we can infer that, it first executed the module load anaconda command by loading the anaconda module to your environment and then activated the custom environment in it.
After you have the bash script ready with the commands, enter the source command followed by path to script file in the text entry box.
Syntax
source <path to bash script file>
Example
source "$HOME/project_a/setup-env.sh"
Launching the Interactive Session
-
Once all the form fields are set, click the
Launch
button. The interactive session will be launched and the below output is shown.

-
The above output shows that the interactive Jupyter session has been launched successfully. You will see the Connect to Jupyter button only if the resources you have requested becomes available. Else, you might need to wait for some more minutes for the resources allocation and then the Connect to Jupyter button appears.
-
Click the Connect to Jupyter button after it appears.
The interactive session won’t be launched if you try to submit your job to the partition that you don’t have access to. You will get the following error message → Batch job submission failed: User’s group not permitted to use this partition. Also, the page gets reloaded and you need to select the value for the form fields again since the form gets reset. |
Opening Jupyter Lab/NoteBook
-
On clicking the Connect to Jupyter button, the Jupyter Lab opens in a new tab.

-
The above output shows that the Jupyter Lab has been successfully connected.
-
On clicking the Connect to Jupyter button, the Jupyter NoteBook opens in a new tab like below.

If you have logged out of Jupyter Lab/NoteBook and wants to log in again, click the Connect to Jupyter button to open the Jupyter Lab/NoteBook in a new tab again. |
Killing the Interactive Session

To kill the interactive session, select File → Shut Down. This will shut down the Jupyter lab and kills the interactive session running on the compute nodes.

-
To kill the interactive session, you can simply press the
quit
button of the Jupyter NoteBook. This will close the session and the cluster resources get freed. -
Try refreshing the page and you will see the message
Failed to connect to discovery
. If you see this message, it means that you have deleted the interactive session successfully, If you don’t see the failure message on page refresh, press thequit
button again and it will do the trick this time.
Alternate Way
-
Another way to kill the session is to go to the
My Interactive sessions
tab and select theDelete
button of the current interactive session.

-
A confirmation pop-up will appear and press
Confirm
to delete the session.
Whenever you are done with the work, it’s always recommended to kill/delete the interactive session running on the compute nodes and free the resources. |
Switching Between Different Virtual Environments from Jupyter Lab/Notebook
-
Anaconda Virtual Environments are used to launch interactive application such as Jupyter Lab/Notebook in Open OnDemand web interface.
-
One important thing to note is the usage of the package ipykernel. The package provides the python kernel for Jupyter. With the help of the ipykernel package, you can access other python virtual environments in your Jupyter Lab/Notebook, provided the ipykernel package is installed.
-
By Default, the base enviornment includes ipykernel package.
-
Let’s look at the below example on how this ipykernel package is very beneficial in Jupyter Lab/Notebook when launched using Anaconda Environment.
Example
-
First, create a test_python Python environment with ipykernel installed using the below command.
[username@discovery-l2 ~]$ module load anaconda [username@discovery-l2 ~]$ conda create -n test_python python=3.6 ipykernel
-
Next, launch an interactive Jupyter Lab from Open OnDemand. Fill the form field and launch it without any advanced settings selection.
-
By Default, Jupyter Lab will be loaded from the base environment with Anaconda3 as the version if you don’t opt for any advanced settings selection and you will get a similar output like below.
Output

-
If you look at the above output, even though the Jupyter Lab has been launched from the base environment, you can still switch to other Python virtual environments which is displayed in the Launcher tab. You can also see test_python environment and the reason why it showed up in the launcher is because of the presence of ipykernel package in the test_python environment.
r-irkernel is the equivalent of ipykernel for R environments. |