Oscar
HomeServicesDocumentation
  • Overview
  • Quickstart
  • Getting Started
  • System Hardware
  • Account Information
  • Short "How to" Videos
  • Quick Reference
    • Common Acronyms and Terms
    • Managing Modules
    • Common Linux Commands
  • Getting Help
    • ❓FAQ
  • Citing CCV
  • CCV Account Information
  • Student Accounts
  • Offboarding
  • Connecting to Oscar
    • SSH (Terminal)
      • SSH Key Login (Passwordless SSH)
        • Mac/Linux/Windows(PowerShell)
        • Windows(PuTTY)
      • SSH Configuration File
      • X-Forwarding
      • SSH Agent Forwarding
        • Mac/Linux
        • Windows (PuTTY)
      • Arbiter2
    • Open OnDemand
      • Using File Explorer on OOD
      • Web-based Terminal App
      • Interactive Apps on OOD
      • Using Python or Conda environments in the Jupyter App
      • Using RStudio
      • Desktop App (VNC)
    • SMB (Local Mount)
    • Remote IDE (VS Code)
      • From Non-compliant Networks (2-FA)
      • Setup virtual environment and debugger
  • Managing files
    • Oscar's Filesystem
    • Transferring Files to and from Oscar
    • Transferring Files between Oscar and Campus File Storage (Replicated and Non-Replicated)
    • Resolving quota issues
      • Understanding Disk Quotas
    • Inspecting Disk Usage (Ncdu)
    • Restoring Deleted Files
    • Best Practices for I/O
    • Version Control
  • Submitting jobs
    • Running Jobs
    • Slurm Partitions
    • Interactive Jobs
    • Batch Jobs
    • Managing Jobs
    • Job Arrays
    • MPI Jobs
    • Condo/Priority Jobs
    • Dependent Jobs
    • Associations & Quality of Service (QOS)
  • GPU Computing
    • GPUs on Oscar
      • Grace Hopper GH200 GPUs
      • H100 NVL Tensor Core GPUs
      • Ampere Architecture GPUs
    • Submitting GPU Jobs
    • Intro to CUDA
    • Compiling CUDA
    • Installing Frameworks (PyTorch, TensorFlow, Jax)
      • Installing JAX
      • Installing TensorFlow
    • Mixing MPI and CUDA
  • Large Memory Computing
    • Large Memory Nodes on Oscar
  • Software
    • Software on Oscar
    • Using Modules
    • Migration of MPI Apps to Slurm 22.05.7
    • Python on Oscar
    • Python in batch jobs
    • Installing Python Packages
    • Installing R Packages
    • Using CCMake
    • Intro to Parallel Programming
    • Anaconda
    • Conda and Mamba
    • DMTCP
    • Screen
    • VASP
    • Gaussian
    • IDL
    • MPI4PY
  • Jupyter Notebooks/Labs
    • Jupyter Notebooks on Oscar
    • Jupyter Labs on Oscar
    • Tunneling into Jupyter with Windows
  • Debugging
    • Arm Forge
      • Configuring Remote Launch
      • Setting Job Submission Settings
  • MATLAB
    • Matlab GUI
    • Matlab Batch Jobs
    • Improving Performance and Memory Management
    • Parallel Matlab
  • Visualization 🕶
    • ParaView Remote Rendering
  • Singularity Containers
    • Intro to Apptainer
    • Building Images
    • Running Images
    • Accessing Oscar Filesystem
      • Example Container (TensorFlow)
    • Singularity Tips and Tricks
  • Installing Software Packages Locally
    • Installing your own version of Quantum Espresso
    • Installing your own version of Qmcpack
  • dbGaP
    • dbGaP Architecture
    • dbGaP Data Transfers
    • dbGaP Job Submission
  • RHEL9 Migration
    • RHEL-9 Migration
    • LMOD - New Module System
    • Module Changes
    • Testing Jupyter Notebooks on RHEL9 mini-cluster
  • Large Language Models
    • Ollama
Powered by GitBook
On this page
  • Installing Jupyter Lab
  • Running Jupyter Lab on Oscar
  • In a OOD Desktop App VNC Session
  • Using a Batch Job
  • 1. Submit batch script
  • 2. Setup an ssh tunnel to the notebook server
  • 3. Open a browser to view the lab
  • In an Interactive Session
  • 1.Start Jupyter Lab in in interactive job
  • 2. Setup an ssh tunnel to the server
  • 3. Open a browser to view the notebook
  • 4. Press Ctrl+C twice to kill your Jupyter Lab server

Was this helpful?

Export as PDF
  1. Jupyter Notebooks/Labs

Jupyter Labs on Oscar

PreviousJupyter Notebooks on OscarNextTunneling into Jupyter with Windows

Last updated 1 year ago

Was this helpful?

Installing Jupyter Lab

The anaconda modules provide jupyter-lab. Users can also use pip or anaconda to .

Running Jupyter Lab on Oscar

There are a couple of ways to use Lab on Oscar. You can run a Jupyter Lab

  • in an

  • using a batch job

  • in an interactive session

With the batch job or interactive session method, you use a browser on your machine to connect to your Jupyter Lab server on Oscar.

Do not run Jupyter Lab on login nodes.

In a OOD Desktop App VNC Session

Start an session, and open up a terminal in the VNC session. To start a Jupyter Lab, enter

jupyter-lab

This will start the Jupyter lab server and open up a browser with the lab.

If you installed Jupyter Lab with pip, you may need to give the full path:

~/.local/bin/jupyter-lab

Using a Batch Job

  1. Submit an ssh tunnel to the server.

  2. Set up an ssh tunnel to the server.

  3. Open a browser to view the lab.

  4. Use scancel to end the batch job when you are done.

1. Submit batch script

Here is an example batch script to start a Jupyter Lab server on an Oscar compute node

#!/bin/bash
#SBATCH --nodes 1
#SBATCH -c 6
#SBATCH --time 04:00:00
#SBATCH --mem-per-cpu 3G
#SBATCH --job-name tunnel
#SBATCH --output jupyter-log-%J.txt
## get tunneling info
XDG_RUNTIME_DIR=""
ipnport=$(shuf -i8000-9999 -n1)
ipnip=$(hostname -i)
## print tunneling instructions to jupyter-log-{jobid}.txt
echo -e "
    Copy/Paste this in your local terminal to ssh tunnel with remote
    -----------------------------------------------------------------
    ssh -N -L $ipnport:$ipnip:$ipnport $USER@ssh.ccv.brown.edu
    -----------------------------------------------------------------
    Then open a browser on your local machine to the following address
    ------------------------------------------------------------------
    localhost:$ipnport  (prefix w/ https:// if using password)
    ------------------------------------------------------------------
    "
## start an ipcluster instance and launch jupyter server
module load anaconda/3-5.2.0
jupyter-lab --no-browser --port=$ipnport --ip=$ipnip

If you installed Jupyter Lab with pip, you may need to give the full path:

~/.local/bin/jupyter-lab --no-browser --port=$ipnport --ip=$ipnip

This script can be found in ~/batch_scripts. Copy this example and submit this script with

sbatch jupyter.sh

Once your batch job is running there will be a file named jupyter-log-{jobid}.txtcontaining the information you need to connect to your Jupyter lab server on Oscar. To check if your job is running, use myq.

The output from myq will look something like this:

Jobs for user mhamilton

Running:
ID       NAME    PART.  QOS          CPU  WALLTIME  REMAIN   NODES
7239096  tunnel  batch  pri-mhamilt  6    4:00:00   3:57:33  node1036

Pending:
(none)

2. Setup an ssh tunnel to the notebook server

In this example the jobID is 7239096. To view the lab server information, use cat. For this example:

cat jupyter-log-7239096.txt

Open a terminal on your machine and copy and paste the ssh -N -L ........ line into the terminal.

 ssh -N -L $ipnport:$ipnip:$ipnport user@ssh.ccv.brown.edu

Enter your Oscar password. Note it will appear that nothing has happened.

3. Open a browser to view the lab

Open a browser on your local machine to the address given in cat jupyter-log-{jobid}.txt.

localhost:9349  (prefix w/ https:// if using password)

The lab will ask for a token. Copy the token from jupyter-log-{jobid}.txt. Then your lab will start.

Remember to scancel {jobid} when you are done with your notebook session

In an Interactive Session

  1. Start Jupyter Lab in an interactive job

  2. Setup an ssh tunnel to the server.

  3. Open a browser to view the notebook.

  4. Use scancel to end the batch job when you are done.

1.Start Jupyter Lab in in interactive job

unset XDG_RUNTIME_DIR
module load anaconda/3-5.2.0
ipnport=$(shuf -i8000-9999 -n1)
echo $ipnport
ipnip=$(hostname -i)
echo $ipnip
jupyter-lab --no-browser --port=$ipnport --ip=$ipnip

An output similar to the one below indicates that Jupyter Lab has started:

$ jupyter-lab --no-browser --port=$ipnport --ip=$ipnip

[I 13:12:03.404 LabApp] JupyterLab beta preview extension loaded from /gpfs/runtime/opt/anaconda/3-5.2.0/lib/python3.6/site-packages/jupyterlab

[I 13:12:03.404 LabApp] JupyterLab application directory is /gpfs/runtime/opt/anaconda/3-5.2.0/share/jupyter/lab

[I 13:12:03.410 LabApp] Serving notebooks from local directory: /gpfs_home/yliu385

[I 13:12:03.410 LabApp] 0 active kernels

[I 13:12:03.410 LabApp] The Jupyter Notebook is running at:

[I 13:12:03.410 LabApp] http://172.20.209.7:9414/?token=dd9936098d03b8195fc626f017c97ca56a054887d134cb1e

[I 13:12:03.410 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[C 13:12:03.411 LabApp]

2. Setup an ssh tunnel to the server

Open a terminal on your machine and enter the following line (replace $ipnip and $ipnport with the values from the two echo commands in the previous step).

 ssh -N -L $ipnport:$ipnip:$ipnport user@ssh.ccv.brown.edu

Enter your Oscar password. Note it will appear that nothing has happened.

3. Open a browser to view the notebook

Open a browser on your local machine to the address:

localhost:$ipnport  (prefix w/ http:// if using password)

Again, you need to replace $ipnport with the value from the first echo command in Step 1. The notebook will ask for a token. You can copy the token from the output from Step 2.

4. Press Ctrl+C twice to kill your Jupyter Lab server

Once you finish and no longer need the Jupyter Lab server, you can kill the server by pressing Ctrl+C twice in your interactive session.

If you are using Windows, follow the documentation to complete this step.

Start an and then in your interactive session enter the following:

If you are using Windows, follow the documentation to complete this step.

install jupyter lab
Jupyter
OOD Desktop App (VNC)
OOD Desktop App (VNC)
Tunneling into Jupyter with Windows
Interactive job
Tunneling into Jupyter with Windows