Prerequisites
Before you begin, make sure you have Jupyter installed on your personal computer. Here’s how to do it:
Installation via Python
- Create a virtual environment:
$ python3 -m venv jupyter_test
- Activate the virtual environment:
$ source jupyter_test/bin/activate
- Install Jupyter Lab:
$ pip install jupyterlab
Note: If you are using Anaconda (version 2024.06), Jupyter is already included.
Accessing Jupyter on the Frontend ($HOME)
Part I: Starting a Job with a Jupyter Notebook Server on the vm-projet
Step 1: Log in to your account
Log in to your explor account using SSH:
$ ssh -p <port> login@193.54.9.82
login@193.54.9.82's password:
Step 2: Load the necessary modules
Load the necessary modules to run Jupyter on the vm-projet:
[login@vm-projet ~]$ module load anaconda3/2024.06
[login@vm-projet ~]$ source $HOME_ANACONDA/anaconda.rc
(base) [login@vm-projet ~]$
Step 3: Launch Jupyter Notebook
Launch Jupyter Notebook with the following command:
(base) [login@vm-projet ~]$ jupyter notebook --no-browser --port=8888 --ip=0.0.0.0
Example output:
[I 2025-03-06 10:52:44.630 ServerApp] Jupyter Server 2.14.1 is running at:
[I 2025-03-06 10:52:44.630 ServerApp] http://vm-projet:8888/tree?token=856bf559f7b34d11a5c87e4e755b7221d4757ef001bf94b6
Note the provided URL, as you will need it to connect to the server.
Part II: Opening a Notebook through an SSH Tunnel
Step 1: Open the SSH Tunnel
Open an SSH tunnel in a shell session on your workstation:
$ ssh -fNL 8888:localhost:8888 -p <port> login@193.54.9.82
login@193.54.9.82's password:
- The first port (8888) corresponds to your local machine. You can adjust it if necessary.
- The second port (8888) is that of the server, as specified when launching Jupyter Notebook on the vm-projet.
Step 2: Launch the Notebook
Activate your virtual environment and launch Jupyter:
$ source jupyter_test/bin/activate
(jupyter_test) user@work-station:~$ jupyter notebook
Step 3: Access the Notebook
In your browser, open the URL provided by the notebook server, replacing the vm-projet name with localhost
:
Replace:
http://vm-projet:8888/tree?token=856bf559f7b34d11a5c87e4e755b7221d4757ef001bf94b6
With:
http://localhost:8888/tree?token=856bf559f7b34d11a5c87e4e755b7221d4757ef001bf94b6
You should now be connected to your Jupyter notebook running on the vm-projet.
Accessing Jupyter on Compute Nodes
Part I: Starting a Job with a Jupyter Notebook Server on a Compute Node
Step 1: Log in to your account
Log in to your explor account using SSH:
$ ssh -p <port> login@193.54.9.82
login@193.54.9.82's password:
Step 2: Request a Reservation
Request a reservation for an interactive connection to a node, for example for a GPU node:
[login@vm-projet ~]$ salloc -A projet -N1 -p gpu -w noeud -t 1:00:00 srun --pty bash
Example output:
salloc: Pending job allocation 1344365
salloc: job 1344365 has been allocated resources
salloc: Granted job allocation 1344365
salloc: Waiting for resource configuration
salloc: Nodes gpf01 are ready for job
Step 3: Load the necessary modules
Load the necessary modules to run Jupyter on the node:
[login@node ~]$ module load anaconda3/2024.06
[login@node ~]$ source $HOME_ANACONDA/anaconda.rc
(base) [login@node ~]$
Step 4: Launch Jupyter Notebook
Launch Jupyter Notebook with the following command:
(base) [login@node ~]$ jupyter notebook --no-browser --port=8888 --ip=0.0.0.0
Example output:
[I 2024-11-22 18:50:20.263 ServerApp] Jupyter Server 2.14.1 is running at:
[I 2024-11-22 18:50:20.263 ServerApp] http://node:8888/tree?token=0cd965475476ce5b0a5235c4f6fc5f0c82123eb0e8c5b354
Note the provided URL, as you will need it to connect to the server, as well as the name of the compute node.
Part II: Opening a Notebook through an SSH Tunnel
Step 1: Open the SSH Tunnel
Open an SSH tunnel in a shell session on your workstation:
$ ssh -fNL 8888:node:8888 -p <port> login@193.54.9.82
login@193.54.9.82's password:
- The first port (8888) corresponds to your local machine. You can adjust it if necessary.
- The second port (8888) is that of the server, as specified when launching Jupyter Notebook.
Step 2: Launch the Notebook
Activate your virtual environment and launch Jupyter Lab:
$ source jupyter_test/bin/activate
(jupyter_test) user@work-station:~$ jupyter notebook
Step 3: Access the Notebook
In your browser, open the URL provided by the notebook server, replacing the node name with localhost
:
Replace:
http://node:8888/tree?token=0cd965475476ce5b0a5235c4f6fc5f0c82123eb0e8c5b354
With:
http://localhost:8888/tree?token=0cd965475476ce5b0a5235c4f6fc5f0c82123eb0e8c5b354
You should now be connected to your Jupyter notebook running on the compute node.