Tips for using Jupyter Notebook in the Institute

Permanent Link: topicbacklinks

It's usually easiest to run Jupyter Notebook on the computer your interactive session runs on.

The reason:
  1. Jupyter Notebook is a little Webserver that calls a Web browser (default is Firefox) to render the Notebook.
  2. Firefox can only run once per Account in the whole institute.
  3. Your browser usually already runs on the computer, your graphical session runs on.

First, we need Jupyter. It's easiest to make a conda environment for that:
  1. Read about Conda here: SoftwarePython .
  2. If you didn't already created a personal conda installation:
    user@host > install-conda
    (Open a new terminal after that)
  3. Create an environment for jupyter:
    user@host > conda create -n jupyter-env
  4. Enter the environment and install Jupyter notebook:
    user@host > ca jupyter-env;conda install notebook

We created a dedicated environement her but Jupyter-notebook can of course be installed into an existing Conda env, as well. To start Jupyter, go to the environment and run it:

user@host > ca jupyter-env;jupyter-notebook

If you need to run Jupyter on a remote computer (e.g. a powerful compute server), we have to do some chores first (explanation below):
  1. Connect to a compute server - e.g. like this:
    user@mycomputer> getserver -sL
  2. Given that we're connected to someserver now, run Jupyter there and force it to not start a browser by itself.
    user@someserver> conda run -n jupyter --no-capture-output jupyter-notebook --no-browser
  3. A URL like this will be shown in Jupyter's output:
    http://localhost:8890/?token=b5e109e9c284ae95daac704e14ca6ba21779a20ab1dca32b
    Remember the port number ( 8890 in this case).
  4. Open another terminal in your interactive session (on your workstation or on the RemoteLinux terminal server). Type this command and replace the port number by the one Jupyter gave you:
    user@mycomputer> ssh -L 8890:localhost:8890 someserver
  5. Open a browser or a new tab.
  6. Copy'n paste the whole URL you got from Jupyter into your browser.

Both terminals (The jupyter one and the one with the ssh tunnel) can be minimized after that.

Explanation:
  • Jupyter notebook is a web application.
  • Web applications require a browser to be used.
  • A browser requires exclusive access to its profile and can therefore only be run once per user account.
  • It's best, to run the browser close to you as possible. Examples:
    • A browser is run on a compute server by calling jupyter-notebook without --no-browser . All the graphical output must now be squeezed through the SSH tunnel. This will feel laggy and slow since graphics operation require lots of function call roundtrips which is a latency multiplier.
    • A browser is run on your workstation (or on the RemoteLinux terminal server). The webpages generated by Jupyter Notebook are fetched through the SSH tunnel was one stream each. Latency has almost no effect here - the remotely run Jupyter will feel indistinguishable from being run directly in graphical session.

This topic: EDV/FuerUser > WebHome > SoftwareLinux > SoftwareJupyter
Topic revision: 02 May 2025, Burk2
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