Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

First, create your virtual environment. We use version 3.79.4 14 to demonstrate in this example. Additionally, we install the virtual environment to our hypothetical home directory in this example, but you may create and use virtual environments wherever is convenient.

Code Block
HMSID@login01:~$ module load gcc/69.2.0 python/3.79.414
HMSID@login01:~$ virtualenv jupytervenv 

Recall from Using Applications on O2 and exploration via module avail that the python/3.79.414 module will not be visible nor loadable until gcc/69.2.0 is loaded.

Now, source the environment, and install jupyter:

...

Expand
titleIf your installation is non-standard, you can try using the manual approach to configure a notebook session (expand this block to view these instructions).

Open a new LOCAL terminal. The following instructions assume you will be connecting from OS X or some other native *nix terminal (e.g. via Debian/CentOS, etc.). If on Windows, use some sort of terminal emulator such as Cygwin or MobaXterm (further configuration may be required, e.g. for X11 forwarding).

Make sure you have X11 forwarding active (e.g. XQuartz is running if on a Mac). You can find additional informations about X11 forwarding at Using X11 Applications Remotely

Pick a port on your local machine that is empty using whatever methods you like (e.g. netstat). Generally, somewhere in the 50000 range is safe if you just want to guess. SSH to O2 with that port (to be mentioned as PORT):

Code Block
me@localhost:~$ ssh -Y -L PORT:127.0.0.1:PORT HMSID@o2.hms.harvard.edu

Now, request an interactive session (for illustrative purposes, we've landed at login01 as our login node):

Code Block
HMSID@login01:~$ srun -t 0-3:00 --pty -p interactive --x11 --tunnel PORT:PORT /bin/bash

If you might require multiple cores and more than 1GB of memory for your notebook, also specify that here, via -n and --mem=. See Using Slurm Basic or the sbatch man page for more sbatch flags. Here, --pty , and --x11 are mandatory. --tunnel is mandatory to complete the tunnel.

Let's pretend we landed on compute-a-16-20. Start the virtual environment and notebook (Jupyter and your virtual environment will require compiler libraries, so you'll need to load GCC as well):

Code Block
HMSID@compute-a-16-20:~$ module load gcc/69.2.0 python/3.79.414
HMSID@compute-a-16-20:~$ source jupytervenv/bin/activate
(jupytervenv)HMSID@compute-a-16-20:~$ jupyter notebook --port=PORT --browser='none'

Alternately, to open an existing notebook:

Code Block
(jupytervenv)HMSID@compute-a-16-20:~$ jupyter notebook NOTEBOOKFILE --port=PORT --browser='none'

On newer versions of Jupyter (notebook >= 4.1), the developers implemented token authentication, which is on by default. If you have a freshly installed version of Jupyter, your notebook will have a token associated with it. When you run the above command, you should see a URL show up in the terminal that contains your session token. Click it, then it should open in your local machine's browser. You're all done!

...

Code Block
HMSID@compute-a-16-68:~$ module load gcc/69.2.0 python/3.79.414 R/3.4.1
HMSID@compute-a-16-68:~$ source jupytervenv/bin/activate
(jupytervenv) HMSID@compute-a-16-68:~$ R
> install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
# select mirror
> devtools::install_github('IRkernel/IRkernel')
> IRkernel::installspec()

...