Ok, what I am presenting is highly adapted from this note from Lj Miranda @ljvmiranda921, thus all credits to him. https://ljvmiranda921.github.io/notebook/2018/01/31/running-a-jupyter-notebook/

The current explanation supposes that you have a Python3 system (3.6+). Generally you can have it in your path or use module system
1/10
First, if not available, install jupyter lab on your distant machine through pip using

"python3 -m pip install --user jupyter-lab"

2/10
Then, add the bash kernel on the distant machine through the procedure described here https://github.com/takluyver/bash_kernel

"python3 -m pip install --user bash_kernel
python3 -m bash_kernel.install"

3/10
Then your jupyter system is ready for launching a Jupyter Lab
Normally, your user-based Jupyter is located in your .local/bin folder

So, you have to launch the jupyter lab on the distant machine from here:

".local/bin/jupyter-lab --no-browser --port=ZZZZZ"

4/10
It will give you some output with a token provided such as:

"http://localhost:ZZZZZ/?token=1f1g2g1g5d12sshgjghj44sd1f1sdgqq442315gjvbbccqs :: /home/USERNAME"

Copy the Token you will need it latter in your local machine.

5/10
On your local machine, launch the following command:

"ssh -N -f -L localhost:AAAA:localhost:ZZZZZ USER@DISTANT"

Then the ZZZZZ port from the distant server will be listened on the AAAA port on the local machine

6/10
Just open your browser (Firefox :D) and type the local address:

"firefox localhost:AAAA"

It will ask you the Token, and then... TaDaa!!

7/10
Ok, problem you have to connect to the distant machine and having a terminal open on it. My first try was to use screen but not satisfying...

Then you can launch the command through ssh directly:

"ssh USER@DISTANT .local/bin/jupyter-lab --no-browser --port=ZZZZZ"
It will send tou the Token in the local terminal.
You just have to open after ssh port forwarding

It will send tou the Token in the local terminal.

You just have to open after ssh port forwarding

9/10
Thanks for all and to @ljvmiranda921 for his inspiration and excellent trick ^^

@pierrepo @TwelveSharp @JulieOrjuela @ItropBioinfo @green_bioinfo @IFB_Bioinfo

10/10
You can follow @francois_sabot.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: