Monthly Archives: July 2018

How to use Jupyter on Della (Head node & Compute node) by module, and how to use R with Jupyter

I set up Jupyter on Della following Brian’s post, including downloading miniconda and install Jupyter locally. Later that week, I attended a OIT office hour (strongly recommended BTW) and the tech people told me that conda and Jupyter are already installed in module. I will repeat the head note part of the guide here for convenience and guides on how to use Jupyter on compute node is also available here.

Set up Jupyter on Della Head Node

First,  ssh into Della

ssh <yourusername>@della.princeton.edu

then load conda module (depend on whether you prefer python 2 or 3)

# load the anaconda environment module
module load anaconda
# or
module load anaconda3

You can also add the module load command in your shell’s startup script (~/.bashrc) to automatically load modules when you log in to a system.

ipython and jupyter have been installed so you can launch the notebook as follows

# For Jupyter Notebook:
jupyter-notebook --no-browser --port=<yourportnumber> --ip=127.0.0.1

and it will provide you a URL with a token which will be used to open your notebook on your local browser

# Example URL:
http://127.0.0.1:3746/?token=8bb5158b39c0ad3f8e312163ba806f743999b8b2d0ca9223

On your local machine, run

ssh -N -f -L localhost:<yourportnumber>:localhost:<yourportnumber> <yourusername>@della.princeton.edu

Last but not least, in your preferred browser go to the above URL 🙂

Set up R with Jupyter

I would also like to repeat the guide on installing IRkernel in order to use R with Jupyter.

In terminal, start R and install the following package using the following command.

Notice: You can install the packages locally, but it will take up a lot of space. It is recommended to install packages in scratch filesystems (/scratch/gpfs/<yourusername>), which has tons of space available (mine is 500GB). You can change the default  R package path by add .libPaths(‘<path>’) in .RProfile.

install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
devtools::install_github('IRkernel/IRkernel')

Then, make kernel available to Jupyter by running

IRkernel::installspec()

If you have issues installing R packages, unload the conda module to give it another try.