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:34] – Add VALET package definition and activation mbotto | software:juypter:caviness [2026-03-27 15:33] (current) – Add output from ls command on workgroup VALET directory mbotto | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Jupyter Notebook Python Virtual Environment on Caviness====== | + | ======Jupyter Notebook Python Virtual Environment on Caviness====== |
| <note warning> | <note warning> | ||
| This page is under construction. | 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 | + | 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 |
| - | 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. | + | Before starting, make sure you [[abstract: |
| <note warning> | <note warning> | ||
| Line 27: | Line 27: | ||
| </ | </ | ||
| - | =====Create Jupyter Notebook Virtual Environment===== | + | =====Create Jupyter Notebook Virtual Environment |
| 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: | 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: | ||
| Line 73: | Line 73: | ||
| # To activate this environment, | # To activate this environment, | ||
| # | # | ||
| - | # $ conda activate /work/it_css/sw/miniforge-testing/ | + | # $ conda activate /work/my_workgroup/sw/conda-envs/ |
| # | # | ||
| # To deactivate an active environment, | # To deactivate an active environment, | ||
| Line 80: | Line 80: | ||
| </ | </ | ||
| - | =====VALET Package Definition===== | + | =====VALET Package Definition |
| 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: | 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: | ||
| Line 86: | Line 86: | ||
| <code bash> | <code bash> | ||
| [(my_workgroup: | [(my_workgroup: | ||
| + | / | ||
| [(my_workgroup: | [(my_workgroup: | ||
| / | / | ||
| Line 126: | Line 127: | ||
| Activating the virtual environment is accomplished using the '' | Activating the virtual environment is accomplished using the '' | ||
| - | < | + | < |
| [(my_workgroup: | [(my_workgroup: | ||
| Adding dependency `miniforge/ | Adding dependency `miniforge/ | ||
| Adding package `jupyter-notebook/ | 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/ | ||
| + | (/ | ||
| + | </ | ||
| + | |||
| + | ====Starting a Jupyter Notebook session==== | ||
| + | |||
| + | When starting the Jupyter Notebook session, specific options are passed which are used to set up the tunnel connection. You should see output similar to the following output: | ||
| + | |||
| + | <code bash> | ||
| + | (/ | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [I 2026-03-27 14: | ||
| + | [C 2026-03-27 14: | ||
| + | |||
| + | To access the server, open this file in a browser: | ||
| + | file:/ | ||
| + | Or copy and paste one of these URLs: | ||
| + | http:// | ||
| + | http:// | ||
| + | [I 2026-03-27 14: | ||
| + | </ | ||
| + | |||
| + | <note warning> | ||
| + | At this point you will not be prompted for any further input, but the Jupyter Notebook server is running. Note the following URL in the output above: | ||
| + | <code bash> | ||
| + | http:// | ||
| + | </ | ||
| + | Before continuing, **make a note of the corresponding URL from your output**, since you will need it for a later step (the token and most likely the compute node name will be different for you). | ||
| + | </ | ||
| + | |||
| + | ====Setting up SSH tunnel to connect to Jupyter Notebook server==== | ||
| + | |||
| + | With the Jupyter Notebook server running on a compute node on Caviness, an SSH tunnel is needed to be able to make a connection and access the Jupyter Notebook server from a web browser on your local machine. This is done by opening a **second** SSH connection to Caviness. Follow the appropriate section below for a Linux/Mac or Windows laptop. | ||
| + | |||
| + | <note warning> | ||
| + | Your compute node name will likely be different than '' | ||
| + | </ | ||
| + | |||
| + | ==Linux/ | ||
| + | Open a new terminal session on your local machine. Set up an SSH tunnel using the below '' | ||
| + | < | ||
| + | $ ssh -L 8888: | ||
| + | </ | ||
| + | |||
| + | ==Windows (Command Prompt or PowerShell)== | ||
| + | Open a new Command Prompt or PowerShell session on your local machine. Set up an SSH tunnel using the below '' | ||
| + | < | ||
| + | > ssh -L 8888: | ||
| + | </ | ||
| + | |||
| + | ==Windows (WSL)== | ||
| + | Open a Linux terminal via WSL on your local machine. Set up an SSH tunnel using the below '' | ||
| + | < | ||
| + | $ ssh -L 8888: | ||
| + | </ | ||
| + | |||
| + | ====Using your local browser to access Jupyter Notebook server==== | ||
| + | |||
| + | If everything so far has been set up correctly, the final step is as easy as opening a web browser of choice on your local machine and entering the correct URL. You should now use the URL that you previously made a note of from the output of the '' | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | then in your browser, you would copy: | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | You should now see Jupyter running on your browser. | ||
| + | |||
| + | Note that since this example ran the '' | ||
| + | |||
| + | <note important> | ||
| + | If you are not able to connect to the Jupyter Notebook session at this point, then you will need to review the prior steps and make sure that you have added and configured the SSH tunnel properly based on your compute node. Remember, the SSH tunnel connection will have to remain open the entire time while you are using Jupyter Notebook. | ||
| + | </ | ||