Skip to content

Instantly share code, notes, and snippets.

@sivadasetty
Last active July 28, 2023 21:16
Show Gist options
  • Save sivadasetty/64e954ffd11d4c066d066e77b974cc76 to your computer and use it in GitHub Desktop.
Save sivadasetty/64e954ffd11d4c066d066e77b974cc76 to your computer and use it in GitHub Desktop.

Method 1:

Connect via ssh

  1. Terminal 1: ssh <username>@xxxx.yyyy.zzzz.edu
  2. Get a interactive compute node

Create conda environment

  1. conda create --prefix <path-to-environment/environment_name> python=XXXX
  2. conda activate <path-to-environment/environment_name>
  3. conda env update --file <environment.yml>

Add Jupyter notebook shortcut in ~/.bashrc

  1. ip=echo $(/sbin/ip route get 8.8.8.1 | awk '{print $7;exit}')
  2. alias launch_notebook='jupyter notebook --no-browser --ip="$ip"'

launch_notebook

Method 2: Port forward to localhost

(PPPP is the port number (may be 4232 or any other available port)) 0. Terminal 0: Login to cluster (ssh <username>@xxxx.yyyy.zzzz.edu) and request a compute node (sinteractive or batch job with sleep 24h.

  1. Terminal 1: ssh <username>@xxxx.yyyy.zzzz.edu -LPPPP:NODE:PPPP -N
  2. Terminal 0: On the compute node: jupyter lab --ip=0.0.0.0 --port=PPPP or jupyter notebook --ip=0.0.0.0 --port=PPPP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment