Prerequisite:

  • python3-pip package
  • python3-dev package

Installation

This is only done per new project:

remote@~  $ mkdir project_foo && cd project_foo
remote@~/project_foo $ python3 -m venv env_foo

This is done every time you launch the JupyterLab server remotely:

local $ ssh -L 8080:localhost:8080 remote@my.server
remote@~/project_foo $ source ˜ /project_foo/bin/activate
(env_foo) $ jupyter lab --no-browser --port 8080
...
[I 17:13:43.778 LabApp] Serving notebooks from local directory: /home/remote
[I 17:13:43.778 LabApp] Jupyter Notebook 6.1.3 is running at:
[I 17:13:43.779 LabApp] http://localhost:8080/?token=35a68d738b9cbd72a0910452f8d4446c6b250c34c37b2fa2
[I 17:13:43.779 LabApp]  or http://127.0.0.1:8080/?token=35a68d738b9cbd72a0910452f8d4446c6b250c34c37b2fa2
[I 17:13:43.779 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

And then in your local browser:

http://localhost:8080/?token=35a68d738b9cbd72a0910452f8d4446c6b250c34c37b2fa2