Run a Jupyter Notebook on Holodeck

Jupyter is a project that provides interactive notebooks containing code. Their premise is, that they can be accessed from anywhere and are shareable. Therefore having Holodeck host a Python (or other language) Notebook enables you to use the computational power from any device that can run a browser and connect to Holodeck.

Setup on Holodeck

Before you can access a Jupyter Notebook you need to setup the server on Holodeck. To do so you will need a Anaconda environment. Check out this wiki page for instructions on how to install it.

Afterwards activate the Anaconda environment and make sure, that Jupyter is installed. To check if Jupyter is isntalled type
jupyter --version

If it returns some version number, Jupyter is installed and you can proceed. Otherwise install it via
conda install jupyter

Afterwards you need to set some options for Jupyter to run on Holodeck. First you need to generate a config file. To do so type
jupyter notebook --generate-config

Afterwards you will need to change two settings in the config file. To access the config file type
nano ~/.jupyter/jupyter_notebook_config.py

You will now need to search for two lines and change their values. To use the search function press Ctrl + W. The first line you will need to edit reads
#c.NotebookApp.open_browser = True

You need to change it to
c.NotebookApp.open_browser = False

(Note that there is no # in front)

The second line is a bit trickier, as you can’t change it to a fixed value. You need to change the port that Jupyter uses. If you use the same port as somebody else, the notebooks will be terminated. Therefore ports in use right now are: P=8888(Wolfgang), 8890(Sebastian), 8885(Yoshinta), 8887(Frank), 8883(Florian)
Therefore don’t use any of the numbers above and try to leave a bit of room.

The line you want to change reads
#c.NotebookApp.port = 8888

and you want to change it to
c.NotebookApp.port = <free_port>

(Note that there is no # in front)

where you replace <free_port> by some free port number. (Ask Frank or the IT if you are unsure.)

After you have changed the two lines above you can save and exit by pressing Ctrl + O → Enter → Ctrl + X and start the server by typing
jupyter notebook

The command will spit out some url. Copy it by marking it and pressing Ctrl + Shift + C.

Tip: If you want to keep the server running for extended periods of time and disconnect from the server, run it in the background or in a screen. For instructions on how to do so see here.

Connect to the Server running the Jupyter Notebook

First, you need to start an ssh-tunnel to the Jupyter server by typing
gsissh -L <port>:localhost:<port> -N holodeck1.aei.uni-hannover.de

and replace <port> by the port you have assigned to your Jupyter server. If you forgot the port, simply connect to Holodeck and type
cat ~/.jupyter/jupyter_notebook_config.py | grep "c.NotebookApp.port = "

Do not close the terminal this is running in! Afterwards you can open a browser and paste the url you got from running
jupyter notebook

on Holodeck. If everything worked out, you should now see the Jupyter file browser.

See also

Setup a virtual environment for Python · Transfer files to and from Holodeck · Useful commands

-- MarlinSchFer - 01 Jul 2019

This topic: NumRel > WebHome > HoloDeck > HoloJupyter
Topic revision: 23 Sep 2019, FlorianWicke
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback