Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| software:juypter:caviness [2026-03-26 16:51] – Progress on section on running with an interactive job mbotto | software:juypter:caviness [2026-03-30 14:16] (current) – Delete obsolete copy (with misspelled path name) of Jupyter Notebook Caviness page mbotto | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ======Jupyter Notebook Python Virtual Environment on Caviness====== | ||
| - | <note warning> | ||
| - | This page is under construction. | ||
| - | </ | ||
| - | The following steps will walk you through setting up a Conda virtual environment with Python 3 and Jupyter Notebook. It will also cover the steps of requesting a compute node to run a Jupyter Notebook session on Caviness. Lastly, it will explain how to set up SSH connections to be able to connect to the Jupyter Notebook session running on a compute node. | ||
| - | |||
| - | Before starting, make sure you set your workgroup. This example will demonstrate how to create a shared directory in your workgroup storage where you can create Conda environments that are accessible to everyone in your workgroup. | ||
| - | |||
| - | <note warning> | ||
| - | If you do not have a '' | ||
| - | </ | ||
| - | |||
| - | Before creating the Jupyter Notebook environment, | ||
| - | |||
| - | <code bash> | ||
| - | [user@login00.caviness ~]$ workgroup -g my_workgroup | ||
| - | [(my_workgroup: | ||
| - | </ | ||
| - | |||
| - | <note important> | ||
| - | The environment variable '' | ||
| - | |||
| - | <code bash> | ||
| - | [user@login00.caviness ~]$ ls -d ${WORKDIR}/ | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | =====Create Jupyter Notebook Virtual Environment with Conda===== | ||
| - | |||
| - | This example will use the Miniforge VALET package to enable usage of the Conda package manager. If you are new to Conda, make sure to review the documentation for [[software: | ||
| - | |||
| - | Start by loading the Miniforge VALET package (this command loads the default version, but you can specify a different version as needed): | ||
| - | |||
| - | <code bash> | ||
| - | [(my_workgroup: | ||
| - | Adding package `miniforge/ | ||
| - | </ | ||
| - | |||
| - | After loading Miniforge, we can now use '' | ||
| - | |||
| - | <code bash> | ||
| - | [(my_workgroup: | ||
| - | Retrieving notices: done | ||
| - | Channels: | ||
| - | - conda-forge | ||
| - | Platform: linux-64 | ||
| - | Collecting package metadata (repodata.json): | ||
| - | Solving environment: | ||
| - | . | ||
| - | . | ||
| - | . | ||
| - | ## Package Plan ## | ||
| - | |||
| - | environment location: / | ||
| - | |||
| - | added / updated specs: | ||
| - | - jupyter | ||
| - | - python=3 | ||
| - | . | ||
| - | . | ||
| - | . | ||
| - | Proceed ([y]/n)? y | ||
| - | . | ||
| - | . | ||
| - | . | ||
| - | Downloading and Extracting Packages: | ||
| - | |||
| - | Preparing transaction: | ||
| - | Verifying transaction: | ||
| - | Executing transaction: | ||
| - | # | ||
| - | # To activate this environment, | ||
| - | # | ||
| - | # $ conda activate / | ||
| - | # | ||
| - | # To deactivate an active environment, | ||
| - | # | ||
| - | # $ conda deactivate | ||
| - | </ | ||
| - | |||
| - | =====VALET Package Definition for the Virtual Environment===== | ||
| - | |||
| - | The new virtual environment can easily be added to your login shell and job runtime environments using VALET. Ensure you have a workgroup VALET package definition directory present, and get the path to the parent directory of your Jupyter Notebook virtual environment: | ||
| - | |||
| - | <code bash> | ||
| - | [(my_workgroup: | ||
| - | [(my_workgroup: | ||
| - | / | ||
| - | </ | ||
| - | |||
| - | Take note of the path echoed, then create a new file in '' | ||
| - | |||
| - | <code yaml jupyter-notebook.vpkg_yaml> | ||
| - | jupyter-notebook: | ||
| - | prefix: / | ||
| - | description: | ||
| - | flags: | ||
| - | - no-standard-paths | ||
| - | actions: | ||
| - | - action: source | ||
| - | script: | ||
| - | sh: miniforge-activate.sh | ||
| - | order: failure-first | ||
| - | success: 0 | ||
| - | versions: | ||
| - | " | ||
| - | description: | ||
| - | dependencies: | ||
| - | - miniforge | ||
| - | </ | ||
| - | |||
| - | =====Activating the Jupyter Notebook Virtual Environment with VALET===== | ||
| - | The versions of the virtual environment declared in the VALET package are listed using the '' | ||
| - | |||
| - | <code bash> | ||
| - | [(my_workgroup: | ||
| - | |||
| - | Available versions in package (* = default version): | ||
| - | |||
| - | [/ | ||
| - | jupyter-notebook | ||
| - | * 20260326 | ||
| - | </ | ||
| - | |||
| - | Activating the virtual environment is accomplished using the '' | ||
| - | |||
| - | <code bash> | ||
| - | [(my_workgroup: | ||
| - | Adding dependency `miniforge/ | ||
| - | Adding package `jupyter-notebook/ | ||
| - | (/ | ||
| - | </ | ||
| - | |||
| - | You can deactivate the virtual environment and remove the VALET packages it depends on with: | ||
| - | <code bash> | ||
| - | (/ | ||
| - | [(my_workgroup: | ||
| - | </ | ||
| - | |||
| - | ===== Running Jupyter Notebook on Caviness ===== | ||
| - | |||
| - | Running Jupyter Notebook on Caviness, or any HPC cluster for that matter, takes some extra steps. You can simply install Jupyter Notebook on your personal laptop and start it up. On Caviness, you need to run the Jupyter Notebook on a compute node. The steps below will show you how to request an interactive compute node and use VALET to load the Jupyter Notebook virtual environment. After starting the virtual environment, | ||
| - | |||
| - | <note warning> | ||
| - | On Caviness you're **required** to run Jupyter notebook on a **compute node**. If you run it on the login node, you could cause slowness or other issues with the login node, and IT might kill your Jupyter Notebook session without warning. | ||
| - | </ | ||
| - | |||
| - | ====Requesting an Interactive Job==== | ||
| - | |||
| - | In this example we will request an interactive job to connect us to a compute node with 2GB of memory for 1 hour on the '' | ||
| - | <code bash> | ||
| - | [(my_workgroup: | ||
| - | </ | ||
| - | |||
| - | ==== Loading the Jupyter Notebook virtual environment ==== | ||
| - | After the interactive job has been established, | ||
| - | |||
| - | <code bash> | ||
| - | [(my_workgroup: | ||
| - | Adding dependency `miniforge/ | ||
| - | Adding package `jupyter-notebook/ | ||
| - | (/ | ||
| - | </ | ||