Skip to content

Instantly share code, notes, and snippets.

@sheyu921
Created January 16, 2024 02:10
Show Gist options
  • Save sheyu921/a419ad3f771724fef00fca1e737abe35 to your computer and use it in GitHub Desktop.
Save sheyu921/a419ad3f771724fef00fca1e737abe35 to your computer and use it in GitHub Desktop.
How_to_jupyter
How to run jupyter lab/notebook on the server
First install and confige jupyter
Install:
conda activate ???? (your virtual env)
conda install jupyter notebook
Confige:
jupyter server --generate-config
jupyter server password
1. Sbatch jupyter.sh
#!/bin/bash
#SBATCH -o jupyter.out
#SBATCH -J jupyterlab
#SBATCH -w compute06
#SBATCH -p cpu
port=2222
ip=`ifconfig |grep -m 1 inet |awk '{print$2}'`
jupyter lab --no-browser --port=${port} --ip=${ip}
2. open jupyter.out check IP of the node
..............
[I 2024-01-16 09:10:42.414 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-01-16 09:10:42.422 ServerApp] notebook | extension was successfully loaded.
[I 2024-01-16 09:10:42.423 ServerApp] Serving notebooks from local directory: /share/home/sheyawen/works/gravity_inversion
[I 2024-01-16 09:10:42.423 ServerApp] Jupyter Server 2.10.0 is running at:
[I 2024-01-16 09:10:42.423 ServerApp] http://192.168.1.6:2222/lab # IP is for the ssh below
[I 2024-01-16 09:10:42.423 ServerApp] http://127.0.0.1:2222/lab
..............
3. create a link to connect the node and local IP
open the cmd or terminal in your computer
ssh -L888?:192.168.1.6:2222 username@10.16.16.101
Details:
?: 8880-8887 is open for the jupyter by now
username is your login name in the IEF server
4. open your browser http://127.0.0.1:888?/lab and enter the password of jupyter lab
?: same with above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment