Jupyterlabt2b: Difference between revisions

From T2B Wiki
Jump to navigation Jump to search
(Created page with "=== How to be able to work with jupyterlab on T2B using Linux personal machine === == Create file "config" in ~/.ssh directory of your personal machine. == Write into the config file: <pre> Host mlong HostName mlong.iihe.ac.be User your_username ForwardX11 yes ServerAliveInterval 100 LocalForward ???? localhost:????" </pre> ''???? is an identical 4-digit number you can invent yourself.''<br /> Save and close the config file. Now you can connect to...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== How to be able to work with jupyterlab on T2B using Linux personal machine ===
=== Work with Jupyter Lab on T2B using Linux personal machine ===


== Create file "config" in ~/.ssh directory of your personal machine. ==
== Create file "config" in ~/.ssh directory of your personal machine. ==
Line 10: Line 10:
     ForwardX11 yes
     ForwardX11 yes
     ServerAliveInterval 100
     ServerAliveInterval 100
     LocalForward ???? localhost:????"
     LocalForward xxxx localhost:xxxx
</pre>
</pre>
''???? is an identical 4-digit number you can invent yourself.''<br />
''xxxx is an identical 4-digit number you can invent yourself.''<br />
Save and close the config file.
Save and close the config file.


Line 20: Line 20:


== On t2b, activate (or create and activate) a virtual environment and install jupyter. ==
== On t2b, activate (or create and activate) a virtual environment and install jupyter. ==
Create a jupyter config file by:
=== Create a virtual environment by: ===
<pre>
$ mkdir python-envs
$ cd python-envs
$ python3 -m venv jupyter_env
$ source jupyter_env/bin/activate
$ python -m pip install jupyterlab
</pre>
 
=== Create a jupyter config file by: ===
<pre>$ jupyter lab --generate-config</pre>
<pre>$ jupyter lab --generate-config</pre>



Latest revision as of 14:14, 12 March 2024

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.