Skip to content

Jupyter Notebooks

Jupyter Notebook is a web application for creating and sharing computational Python documents.

We provide an interactive app for Jupyter Notebook using the Open OnDemand HPC web portal.

Run Jupyter Notebooks using Open OnDemand#

From the Open OnDemand dashboard, select Interactive AppsJupyter Notebook. You will see something similar to the following screen:

Jupyter Notebook Job Submission Interface

Set the desired parameters, and then click the Launch button.

If you are building a new environment, you should specify a value of at least 8 for the number of cores. It will take a few moments to build the new environment (up to 3 to 10 minutes), during which the job dialog will indicate Starting:

Jupyter Notebook Job Submission Starting

If you are connecting to an already existing Jupyter Notebook environment, your environment will load immediately after your job starts.

Manually configuring a Jupyter Notebook environment#

You have the option of manually building and configuring a Jupyter Notebook environment, rather than using Open OnDemand to automatically build it:

# Load the anaconda environment module
$ module load anaconda

# If you are on a compute node, you will also need to load the webproxy module (ignore this step if you're on a 
# login node)
$ module load webproxy

# Run the initialization step. Substitute your shell if you are using a shell besides bash.
$ conda init bash

# Re-load your runtime environment. Substitute the runtime configuration file for your shell if you are using a shell besides bash.
$ source ~/.bashrc

# You will now see '(base)' prepended before your prompt
(base) $ 

# Create the Jupyter notebook environment. Substitute your own name for 'my_jupyter_notebook'
(base) $ conda create -n my_jupyter_notebook

# Activate the Jupyter Notebook environment
(base) $ conda activate my_jupyter_notebook
(my_jupyter_notebook) $

# You can now use tools like _"conda install"_ to install packages in your environment. For example, if you want to install
# the JupyterLab IDE:
(my_jupyter_notebook) $ conda install juypterlab

To run your newly created notebook on Open OnDemand (see above), take note of the path that the environment location: that was printed during the conda create output:

## Package Plan ##

  environment location: /gpfs/home/USERNAME/.conda/envs/my_jupyter_notebook

Enter this path into the Path to Jupyter Virtual Environment field in Open OnDemand:

Custom path to Jupyter notebook

Using R with Jupyter Notebooks#

Our Jupyter Notebook Open OnDemand app automatically loads "R" and installs the necessary dependencies to use R with Jupyter Notebooks.

Select the version of R that you would like to use on the job submission screen:

Select the version of "R" you would like to use with Jupyter Notebooks

Fill out the remainder of the form, and then follow the instructions above to submit your job. When the job starts, press the "New" button at the upper-right hand corner of the Jupyter notebook screen, and select "R":

Select the version of "R" you would like to use with Jupyter Notebooks

Manually install the "R" kernel in Jupyter#

If you need further customization, you can manually install the "R" kernel in your Jupyter Notebook environment.

# Load requisite environment modules
$ module load anaconda R

# Activate the Conda environment for your existing Jupyter Notebook (see 'Manually configuring a Jupyter Notebook environment' above)
$ conda activate jupyterenv

# Run R after the Jupyter environment is active
(jupyterenv) $ R

# Install IRKernel by running the following command within R
> install.packages('IRkernel')
> IRkernel::installspec()

You can now run "R" in your Jupyter Notebook session.