Difference between revisions of "JupyterLab"

 
(19 intermediate revisions by one other user not shown)
Line 7: Line 7:
'''PLEASE NOTE: Do not run JupyterLab on a login node, as it can be resource intensive. Instead, please ensure that you only run it inside of an [[JupyterLab#Running_JupyterLab_inside_of_an_SRUN_Interactive_Session|SRUN Interactive session]].'''
'''PLEASE NOTE: Do not run JupyterLab on a login node, as it can be resource intensive. Instead, please ensure that you only run it inside of an [[JupyterLab#Running_JupyterLab_inside_of_an_SRUN_Interactive_Session|SRUN Interactive session]].'''


== Using JupyterLab/JupyterNotebook on CIRCE/SC via X2Go==
== Using JupyterLab on CIRCE/SC via X2Go==


=== Installing JupyterLab ===
=== Installing JupyterLab ===


To install JupyterLab, you'll first need to log-in to CIRCE/SC, open a terminal inside of X2Go, and install Miniconda3 using the directions below:
To install JupyterLab, you'll first need to log-in to CIRCE/SC via X2Go, open a terminal window, and install Miniconda3 using the directions below:


====Instructions on installing Miniconda3====
====Instructions on installing Miniconda3====
Line 20: Line 20:
#* answer "yes" to adding Miniconda3 install location to PATH in your ~/.bashrc
#* answer "yes" to adding Miniconda3 install location to PATH in your ~/.bashrc
# log-out of CIRCE/SC, then log back in
# log-out of CIRCE/SC, then log back in
# <pre style="white-space:pre-wrap; width:30%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ conda activate base</pre>
# <pre style="white-space:pre-wrap; width:30%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ which conda pip</pre>
# <pre style="white-space:pre-wrap; width:30%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ which conda pip</pre>
#* make sure it returns with both lines below:  
#* make sure it returns with both lines below:  
#** '''~/miniconda3/bin/conda'''
#** '''~/miniconda3/bin/conda'''
#** '''~/miniconda3/bin/pip'''
#** '''~/miniconda3/bin/pip'''
# <pre style="white-space:pre-wrap; width:30%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ pip install --upgrade pip</pre>
# <pre style="white-space:pre-wrap; width:35%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ pip install --upgrade pip</pre>
# <pre style="white-space:pre-wrap; width:30%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ conda update --all -y</pre>
# <pre style="white-space:pre-wrap; width:30%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ conda update --all -y</pre>
# <pre style="white-space:pre-wrap; width:30%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ conda install -y anaconda</pre>
# <pre style="white-space:pre-wrap; width:35%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ conda install -y anaconda</pre>


Once Miniconda3 is installed, you can proceed with installing JupyterLab.
Once Miniconda3 is installed, you can proceed with installing JupyterLab.
Line 34: Line 35:
To create a dedicated JupyterLab Miniconda virtual environment, you can do so by running the commands below:
To create a dedicated JupyterLab Miniconda virtual environment, you can do so by running the commands below:
# <pre style="white-space:pre-wrap; width:20%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ cd $HOME</pre>
# <pre style="white-space:pre-wrap; width:20%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ cd $HOME</pre>
# <pre style="white-space:pre-wrap; width:55%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ conda create --name jupyter -c conda-forge jupyterlab</pre>
# <pre style="white-space:pre-wrap; width:30%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ conda activate base</pre>
 
# <pre style="white-space:pre-wrap; width:60%; border:1px solid lightgrey; background:#000000; color:white;">(base) [user@itn0 ~]$ conda create --name jupyter -c conda-forge jupyterlab</pre>
# <pre style="white-space:pre-wrap; width:30%; border:1px solid lightgrey; background:#000000; color:white;">(base) [user@itn0 ~]$ conda deactivate</pre>


==== Running JupyterLab inside of an SRUN Interactive Session====
==== Running JupyterLab inside of an SRUN Interactive Session====
&nbsp;
&nbsp;


'''PLEASE NOTE: When running inside of an SRUN interactive session, ensure that your "--time" request is sufficient to complete your processing. If your interactive session runs out of time, your JupyterLab processes will be terminated, and your work will be lost!'''
'''PLEASE NOTE: When running inside of an SRUN interactive session, ensure that your "--time" request is sufficient to complete your processing. If your interactive session runs out of time, your JupyterLab processes will be terminated, and any unsaved work will be lost!'''


Each time you wish to run JupyterLab, you can do so by running the commands below:
Each time you wish to run JupyterLab, you can do so by running the commands below:


# Connect to [[CIRCE/SC_Desktop|CIRCE/SC via X2Go]]
# Connect to [[CIRCE/SC_Desktop|CIRCE/SC via X2Go]]
# Open a terminal window (inside of X2Go) to run commands 3-8 below
# Export your [[SLURM_Interactive#Graphical_Jobs|DISPLAY variable]]
# Export your [[SLURM_Interactive#Graphical_Jobs|DISPLAY variable]]
# Request an SRUN Interactive Session:
#* <pre style="white-space:pre-wrap; width:40%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ export DISPLAY=$(hostname)$DISPLAY</pre>
#* <pre style="white-space:pre-wrap; width:55%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ srun --time=00:30:00 --ntasks=1 --pty /bin/bash</pre>
# Request a 1-core, 1GB of RAM SRUN Interactive Session for 1 hour:
#* <pre style="white-space:pre-wrap; width:65%; border:1px solid lightgrey; background:#000000; color:white;">[user@itn0 ~]$ srun --time=01:00:00 --cpus-per-task=1 --mem-per-cpu=1G --pty /bin/bash</pre>
# Once the SRUN Interactive Session has been dispatched, load your JupyterLab conda environment:
# Once the SRUN Interactive Session has been dispatched, load your JupyterLab conda environment:
#* <pre style="white-space:pre-wrap; width:40%; border:1px solid lightgrey; background:#000000; color:white;">[user@mdc-1057-29-41 ~]$ conda activate jupyter</pre>
#* <pre style="white-space:pre-wrap; width:40%; border:1px solid lightgrey; background:#000000; color:white;">[user@mdc-1057-29-41 ~]$ conda activate jupyter</pre>
# Start Firefox in the background on the compute node:
# Load the module for Firefox and start Firefox in the background:
#* <pre style="white-space:pre-wrap; width:30%; border:1px solid lightgrey; background:#000000; color:white;">[user@mdc-1057-29-41 ~]$ firefox &</pre>
#* <pre style="white-space:pre-wrap; width:49%; border:1px solid lightgrey; background:#000000; color:white;">(jupyter) [user@mdc-1057-29-41 ~]$ module add apps/firefox</pre>
#* <pre style="white-space:pre-wrap; width:49%; border:1px solid lightgrey; background:#000000; color:white;">(jupyter) [user@mdc-1057-29-41 ~]$ firefox &</pre>
# Start JupyterLab:
# Start JupyterLab:
#* <pre style="white-space:pre-wrap; width:35%; border:1px solid lightgrey; background:#000000; color:white;">[user@mdc-1057-29-41 ~]$ jupyter lab</pre>
#* <pre style="white-space:pre-wrap; width:40%; border:1px solid lightgrey; background:#000000; color:white;">(jupyter) [user@mdc-1057-29-41 ~]$ jupyter lab</pre>
# Copy the "localhost:8888" URL from the terminal into Firefox to load the Jupyter Lab GUI


==== Terminating JupyterLab====
==== Terminating JupyterLab====
Line 60: Line 66:


# Close the Firefox window
# Close the Firefox window
# CTRL-C in the terminal window, and enter "y" to confirm terminating the JupyterLab server process
# In the terminal window that you ran "jupyter lab" in (in step 7 of [[JupyterLab#Running_JupyterLab_inside_of_an_SRUN_Interactive_Session|Running JupyterLab inside of an SRUN Interactive Session]]), press CTRL-C and enter "y" to confirm terminating the JupyterLab server process
# <pre style="white-space:pre-wrap; width:40%; border:1px solid lightgrey; background:#000000; color:white;">[user@mdc-1057-29-41 ~]$ conda deactivate jupyter</pre>
# Deactivate your JupyterLab virtual environment
#* <pre style="white-space:pre-wrap; width:40%; border:1px solid lightgrey; background:#000000; color:white;">(jupyter) [user@mdc-1057-29-41 ~]$ conda deactivate</pre>
# Type "exit" to exit your SRUN interactive session


{{Documentation}}
{{Documentation}}

Latest revision as of 14:24, 31 May 2022

Description

From the JupyterLab website: JupyterLab is a web-based interactive development environment for Jupyter notebooks, code, and data. JupyterLab is flexible: configure and arrange the user interface to support a wide range of workflows in data science, scientific computing, and machine learning. JupyterLab is extensible and modular: write plugins that add new components and integrate with existing ones.

JupyterNotebook is one of the tools available for use in the JupyterLab suite.

PLEASE NOTE: Do not run JupyterLab on a login node, as it can be resource intensive. Instead, please ensure that you only run it inside of an SRUN Interactive session.

Using JupyterLab on CIRCE/SC via X2Go

Installing JupyterLab

To install JupyterLab, you'll first need to log-in to CIRCE/SC via X2Go, open a terminal window, and install Miniconda3 using the directions below:

Instructions on installing Miniconda3

  1. [user@itn0 ~]$ cd $HOME
  2. [user@itn0 ~]$ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
  3. [user@itn0 ~]$ chmod +x Miniconda3-latest-Linux-x86_64.sh
  4. [user@itn0 ~]$ ./Miniconda3-latest-Linux-x86_64.sh
    • answer "yes" to adding Miniconda3 install location to PATH in your ~/.bashrc
  5. log-out of CIRCE/SC, then log back in
  6. [user@itn0 ~]$ conda activate base
  7. [user@itn0 ~]$ which conda pip
    • make sure it returns with both lines below:
      • ~/miniconda3/bin/conda
      • ~/miniconda3/bin/pip
  8. [user@itn0 ~]$ pip install --upgrade pip
  9. [user@itn0 ~]$ conda update --all -y
  10. [user@itn0 ~]$ conda install -y anaconda

Once Miniconda3 is installed, you can proceed with installing JupyterLab.

Instructions on installing JupyterLab via Miniconda3

To create a dedicated JupyterLab Miniconda virtual environment, you can do so by running the commands below:

  1. [user@itn0 ~]$ cd $HOME
  2. [user@itn0 ~]$ conda activate base
  3. (base) [user@itn0 ~]$ conda create --name jupyter -c conda-forge jupyterlab
  4. (base) [user@itn0 ~]$ conda deactivate

Running JupyterLab inside of an SRUN Interactive Session

 

PLEASE NOTE: When running inside of an SRUN interactive session, ensure that your "--time" request is sufficient to complete your processing. If your interactive session runs out of time, your JupyterLab processes will be terminated, and any unsaved work will be lost!

Each time you wish to run JupyterLab, you can do so by running the commands below:

  1. Connect to CIRCE/SC via X2Go
  2. Open a terminal window (inside of X2Go) to run commands 3-8 below
  3. Export your DISPLAY variable
    • [user@itn0 ~]$ export DISPLAY=$(hostname)$DISPLAY
  4. Request a 1-core, 1GB of RAM SRUN Interactive Session for 1 hour:
    • [user@itn0 ~]$ srun --time=01:00:00 --cpus-per-task=1 --mem-per-cpu=1G --pty /bin/bash
  5. Once the SRUN Interactive Session has been dispatched, load your JupyterLab conda environment:
    • [user@mdc-1057-29-41 ~]$ conda activate jupyter
  6. Load the module for Firefox and start Firefox in the background:
    • (jupyter) [user@mdc-1057-29-41 ~]$ module add apps/firefox
    • (jupyter) [user@mdc-1057-29-41 ~]$ firefox &
  7. Start JupyterLab:
    • (jupyter) [user@mdc-1057-29-41 ~]$ jupyter lab
  8. Copy the "localhost:8888" URL from the terminal into Firefox to load the Jupyter Lab GUI

Terminating JupyterLab

When you are finished using JupyterLab, you can terminate the processes using the steps below:

  1. Close the Firefox window
  2. In the terminal window that you ran "jupyter lab" in (in step 7 of Running JupyterLab inside of an SRUN Interactive Session), press CTRL-C and enter "y" to confirm terminating the JupyterLab server process
  3. Deactivate your JupyterLab virtual environment
    • (jupyter) [user@mdc-1057-29-41 ~]$ conda deactivate
  4. Type "exit" to exit your SRUN interactive session

Documentation

Home Page, User Guides, and Manuals

Reporting Bugs

Report bugs with JupyterLab to the IT Help Desk: rc-help@usf.edu