Running Jupyter Notebook on a server using your client browser

Running Jupyter Notebook using X-forwarding on a server can be sluggish and unresponsive. Here is how you can use your local browser but still run your code using the servers resources. (Note: we recommend using VS Code for this as described here)

By Kjetil Bakke
Published Mar. 22, 2023
Image may contain: Orange, Font, Material property, Circle, Logo.

What is Jupyter Notebook?

Jupyter Notebook and its flexible interface extends the notebook beyond code to visualization, multimedia, collaboration, and more. In addition to running your code, it stores code and output, together with markdown notes, in an editable document called a notebook. When you save it, this is sent from your browser to the Jupyter server, which saves it on disk as a JSON file with a .ipynb extension.

https://docs.jupyter.org/

Getting started

Log on to the server and start it up.

On the client, connect to the server using ssh. We will use mimi.uio.no in this example.

(Tip: To make ssh connections easier, you can set yourself up with ssh keys)

ssh username@mimi.uio.no 

Load the Anaconda module:

$ module load JupyterLab/4.4.9-GCCcore-14.3.0

First, check if you already have any running notebooks on the server:

$ jupyter lab list

If you do, paste the link from the output in your local browser and continue your work. 

If not, start a new jupyter notebook:

$ jupyter lab --no-browser

[[I  10:04:49.566 ServerApp] jupyter_lsp | extension was successfully linked.
[I  10:04:49.569 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I  10:04:49.573 ServerApp] jupyterlab | extension was successfully linked.
[I  10:04:49.772 ServerApp] notebook_shim | extension was successfully linked.
[I  10:04:49.791 ServerApp] notebook_shim | extension was successfully loaded.
[I  10:04:49.793 ServerApp] jupyter_lsp | extension was successfully loaded.
[I  10:04:49.794 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I  10:04:49.796 LabApp] JupyterLab extension loaded from /opt/software/easybuild/software/JupyterLab/4.4.9-GCCcore-14.3.0/lib/python3.13/site-packages/jupyterlab
[I  10:04:49.797 LabApp] JupyterLab application directory is /opt/software/easybuild/software/JupyterLab/4.4.9-GCCcore-14.3.0/share/jupyter/lab
[I  10:04:49.797 LabApp] Extension Manager is 'pypi'.
[I  10:04:49.824 ServerApp] jupyterlab | extension was successfully loaded.
[I  10:04:49.825 ServerApp] Serving notebooks from local directory: /uio/kant/geo-geofag-u1/kjetba
[I  10:04:49.825 ServerApp] Jupyter Server 2.17.0 is running at:
[I  10:04:49.825 ServerApp] http://localhost:8888/lab?token=1de4ec179100fa4c91cf5b32ab45c1c74b8a56b9953c0cd0
[I  10:04:49.825 ServerApp] http://127.0.0.1:8888/lab?token=1de4ec179100fa4c91cf5b32ab45c1c74b8a56b9953c0cd0

At the bottom of the output is where you will find the URL you need to use with your client browser in the last step. Make note of the port number assigned. In this example 8888. 

Now we need to set up a dedicated ssh tunnel for it to work using the port number assigned. Open another terminal and type in:

ssh -L 8888:localhost:8888 username@mimi.uio.no

Then open the URL in your favorite client browser. In this example: 

http://localhost:8888/?token=d9ed1ac41c33137a65d6ef6db7c4a379f63dca7311198547

 

Published Mar. 22, 2023 4:10 PM - Last modified Nov. 11, 2026 10:08 AM