Connecting to Jupyter
Setting up packages and Security for your Notebook Server
If you have a "freshly-created" SCRTP account, the first time you try to get a notebook server up and running, you will not have appropriate python packages installed. First we need to run an installer script, so please follow steps 1 to 4 of the instructions below. Replace "phrxyz" with your SCRTP username (notyour university number)
Part 1: Install packages for Jupyter and ASE
- Log on to the node via ssh: Load a terminal window on your local machine and connect to a remote machine such as hetmathsys1
ssh phrxyz@hetmathsys1.scrtp.warwick.ac.uk
You will need your SCRTP username and your SCRTP password. If this succeeds, you will be at the Linux command line on hetmathsys1. - On hetmathsys1, run this script for setting up various packages to allow you to runJupyter Notebooks(cut and paste the command):
/storage/physics/apxpcw/QAM/install_jupyter
- When prompted, choose a password for your Jupyter Notebook - this can be the same as your SCRTP password.
- Ask for help if you get any error messages in red. An exception is any that begin "ERROR: pip's dependency resolver does not currently take into account all the packages that are installed" which is (as far as I know) harmless.
- At the end of the setup process, you will need to source your .bashrc file again as instructed.
The current modules this loads (subject to change!) are:
module purge; module load GCC/11.3.0 OpenMPI IPython jupyter-server JupyterLab SciPy-bundle
Part 2: Enabling a Direct Connection
To enable a secure, https-based connection to your jupyter notebook server (so that it is safe to enter your password to connect to other machines), we create and add a ssl key and add it to your jupyter notebook configuration. I have created the following script which does this (read through it first if you are interested):
/storage/physics/apxpcw/QAM/add_key_to_jupyter_configYou will be prompted for information about yourself for the private key you will use. You should put some basic details in here so the key is distinguishable from others, but there is no need to fill it all in accurately as no one else sees this data.
Part 3: Launching a Notebook Server
nohup jupyter notebook &
cat nohup.out
Part 4a: Connecting from within the Warwick Network
https://stan1.csc.warwick.ac.uk:8888Link opens in a new window
https://alpher.theory.warwick.ac.uk:8888Link opens in a new window
https://hetmathsys1.scrtp.warwick.ac.uk:8888Link opens in a new window
You should replace "hostname" with the machine you are running on (eg "stan1") and replace "8888" with the right port number as reported by nohup.out. If you don't know the hostname of the machine, then "uname -n" will tell you.
Part 4b: Connecting from Outside the Warwick Network (Remote Access)
From outside the Warwick network, the range of ports on which we run these notebooks is blocked for external access by the university firewall. Therefore we need to establish an "ssh tunnel" via an allowed, secure method, ie ssh. The purpose of this tunnel is to map a TCP/IP port on your local machine to a port on a remote machine. For simplicity we will use the same port number on both machines.
Let's say you want to get access to a Jupyter Notebook on stan1, running on port 8889. To map port localhost:8889 on stan1 to localhost:8889 on your own machine you would run the following command in a terminal window on your own computer(the one you are at which you are physically sitting - not the one where you are running the server!):
ssh -N -f -L localhost:8889:localhost:8889 phrxyz@stan1.csc.warwick.ac.uk
Replace "stan1" and "phrxyz" and both copies of the port number "8889" with the appropriate values for the machine you have run on, your SCRTP username and the port you got assigned.
Then you would point your browser at this
https://localhost:8889Link opens in a new window
(again, replace the port number) to launch the notebook. You will have to say yes or "continue anyway" to various dire warnings about self-signed certificates (these are OK as you made them).
If you try to connect again later on, but get no response, it maybe that you need to restart the notebook (eg after a reboot of the server).
Part 5: Fetching and Downloading a Workshop Notebook
Part 6: Shutting down a Jupyter Notebook Server
You can shut your notebook server down from inside the notebook (there is a "Quit" button) or from the command line by killing the process ("fg" to bring it back to foreground, the Ctrl-C).
Updating Packages
Those with an older SCRTP account found some of their Python packages are out of date. The following worked to update them but may no longer be compatible with the new OS:
pip3 install --user --upgrade pygments prompt-toolkit ipython nbclient nbconvert jupyter-core jupyter-console
If you have trouble with nglview, this command may help (you'll have to restart jupyter after running this)
pip3 install --upgrade ipywidgets==7.6.0