Comment on page
Jupyter on Lawrence
Request a node:
user.name@login ~]$ srun --pty bash
Make a directory for Jupyter scripts and cd into it.
user.name@node02 ~]$ mkdir jupyterScripts
user.name@node02 ~]$ cd jupyterScripts
Copy the installation and starting scripts into your directory.
user.name@node02 jupyterScripts]$ cp /apps/jupyter-notebook/* ./
user.name@node02 jupyterScripts]$ ls
Run the install script.
Note: If you would like to add kernels to your Jupyter Notebook (e.g. R, widgets, etc.), add the "-h" flag to view options:
- user.name@node02 jupyter]$ bash install-jupyter-notebook.sh -h
user.name@node02 jupyterScripts]$ bash install-jupyter-notebook.sh
Creating new environment now...
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/usd.local/adison.kleinsasser/anaconda3/envs/jupyter
added / updated specs:
The following packages will be downloaded:
package | build
bleach-3.1.1 | py_0 111 KB conda-forge
gst-plugins-base-1.14.5 | h0935bb2_2 6.8 MB conda-forge
Use "exit" to exit the node.
user.name@node02 jupyterScripts]$ exit
Why do we request a node for the installation, and then exit out of it to start Jupyter?
Using another node for the installation process (
install-jupyter-notebook.sh) keeps the login node open for users logging in, however, the script that starts Jupyter
(start-jupyter-notebook.sh)requests a node (within the script), so being in the login node before running it is advised.
(If you are entering the tutorial here, navigate to the directory that contains "start-jupyter-notebook.sh".)
Run start-jupyter-notebook.sh using bash.
Note: to see options for starting Jupyter, add an -h flag to the command:
- user.name@login jupyter]$ bash start-jupyter-notebook.sh -h
user.name@login jupyter]$ bash start-jupyter-notebook.sh
If you have already opened Jupyter before (and your password is already set) you may skip to the "Start Tunnel" section.
If you are starting Jupyter for the first time, it will prompt you to create a password for your Jupyter Notebook installation. This can be changed or reset at a later time and is not related to your University password.
Enter your desired password
Note: the cursor will not move as you type- just like when typing the password to log into Lawrence.
Enter your desired password again
If you forget your password and need to reset it:
Open your Jupyter environment.
Then run "jupyter notebook password". Enter a new password when prompted. (Remember, the cursor won't move while typing a password.)
Don't forget to deactivate your environment.
Why do we bother having a password if it's so easy to reset?
Once the Jupyter server is started, anyone on Lawrence could theoretically access that Jupyter instance if they know the port it is using. The password protects your Jupyter from being accessible by unauthorized people who would have the same read/write access to any files your running Jupyter Notebook session can access.
After running the
bash start-jupyter-notebook.shcommand (and setting a password if necessary), an ssh command and a localhost link will appear in the terminal (They aren't click-able).
Copy the ssh command from the print-out. (Do not use Ctrl-C, it'll cut off the job).
Don't use Ctrl-C
Open a second terminal, and paste the command into it.
Then hit "Enter".
Back in the first terminal, copy the localhost link:
Then open a browser, and paste it in the address bar (Note: your link will likely be different from the one shown- don't copy the one in the picture).
Press "Enter", then enter your password when prompted:
and Jupyter will come up.
When you are done with Jupyter, don't simply close the browser. Make sure you shut down the server as well. Click on the "Quit" button in Jupyter:
The first terminal will then look like this:
Notice that the command prompt has come back. In the second terminal, use Ctrl-C to bring back the command line.