Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

While we do not have an installation of Jupyterhub it is possible to set up a single Jupyter notebook running on the HPC system. This is a relatively straight forward process on Linux and Mac workstations/laptops as these systems have terminal programs built in. The Argon system has jupyter installed in the python stacks so the information here is currently only relevant to the Argon HPC system.

There are two login nodes and normally you will wind up on one or the other based on a round robin scheme. For a jupyter notebook connection though you will have to connect to a specific login node. So, for Argon, pick one of the following login nodes to use:

  • argon-login-1.hpc.uiowa.edu
  • argon-login-2.hpc.uiowa.edu

The example below will use argon-login-1 but either one will work. First login to the HPC system via the selected login node.

ssh argon-login-1.hpc.uiowa.edu

Once on the login node you must select the version of python that you want to use. Run the following command to see the available python environment modules.

module -tr avail ^python

Load the selected python environment module.

module load python/2.7.13

Now, start a jupyter notebook, but without a browser. The goal is to be able to use the browser on your local machine.

jupyter notebook --no-browser

The default port is 8888 but note that if there is anything else using that port, such as another jupyter notebook, then a different port will be used. The above command will automatically try a different port and will report that. The output will look something like the following:

[I 10:26:27.563 NotebookApp] The port 8888 is already in use, trying another port.
[I 10:26:27.574 NotebookApp] Serving notebooks from local directory: /Users/gpjohnsn
[I 10:26:27.574 NotebookApp] 0 active kernels 
[I 10:26:27.574 NotebookApp] The Jupyter Notebook is running at: http://localhost:8889/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[I 10:26:27.574 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 10:26:27.574 NotebookApp] 

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8889/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Do not share the token with anyone.

The important bit of information from the above for the next step is the port that was selected. That can be found immediately after localhost. In the above the port number used is 8889.

You can start the jupyter notebook in a screen or tmux session so that you can detach the terminal. See Screen and Tmux for more information.

Open another terminal session on your local workstation or laptop. We will next set up a tunnel over ssh so that connections to a port on your local machine are forwarded to a port on the remote machine. In this case, the port Jupyter is using on the login node. The port that you use locally is independent of the remote port but it typically makes sense to use the same port number. That will also make a simple copy/paste of the URL presented by jupyter notebook to work. In the newly opened terminal session on your local machine, run the following command:

ssh argon-login-1.hpc.uiowa.edu -L 8889:localhost:8889 -N

That will then forward traffic on the local port 8889 to the remote port 8889.

You could background the port forwarded connection by using the -f flag with ssh. That will return a prompt to the terminal but you will have to keep track of what forwardings you have set up.

Once the port forwarding is setup then copy/paste the URL that was output by jupyter notebook earlier.

http://localhost:8889/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

into the browser of your local machine. That should then open up a session to the jupyter notebook server. When you are finished using the notebook

  1. Control-C in the local session with the ssh port forwarding to stop forwarding.
  2. Control-C in the ssh session on the remote login node where the jupyter notebook was started

Please remember that computationally intensive jobs should not be run on login nodes so be sure to submit those to compute nodes.

  • No labels