From T2B Wiki
Jump to navigation Jump to search

Work with Jupyter Lab on T2B using Linux personal machine

Create file "config" in ~/.ssh directory of your personal machine.

Write into the config file:

Host mlong
    HostName mlong.iihe.ac.be
    User your_username
    ForwardX11 yes
    ServerAliveInterval 100
    LocalForward xxxx localhost:xxxx

xxxx is an identical 4-digit number you can invent yourself.
Save and close the config file.

Now you can connect to T2B using the alias in the ssh config file:

$ ssh mlong

(If this does not work you may want to reopen your terminal.)

On t2b, activate (or create and activate) a virtual environment and install jupyter.

Create a virtual environment by:

$ mkdir python-envs
$ cd python-envs
$ python3 -m venv jupyter_env
$ source jupyter_env/bin/activate
$ python -m pip install jupyterlab

Create a jupyter config file by:

$ jupyter lab --generate-config

Open the jupyter config file in a text editor, e.g.:

$ vim ~/.jupyter/jupyter_lab_config.py

Remove # in front of these 2 lines in the file:

c.ServerApp.open_browser = False
c.ServerApp.port = 0

Change the 0 in the second line to the same 4-digit number you chose in the ssh config file on your personal machine.
Save and close the jupyter config file.
Now you can run:

$ jupyter lab

To open the session in the browser of your personal machine, copy-paste one of the links under

"Or copy and paste one of these URLs:".

To close the session close the tab on your browser, then on t2b command line press "Ctrl+C" twice.