Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

What is Jupyter?

Jupyter is an open-source tool that provides an interactive computing environment, enabling users to create and share documents containing live code, equations, visualizations, and narrative text. Jupyter notebooks are especially popular in data science, machine learning, and scientific computing because they combine code and results in a single, user-friendly interface.

main-logo.svg

Quick Jobs with Jupyter

This method does not support custom conda environments. Please continue reading to follow the instructions in Jupyter through Interactive Session and so on to access Jupyter with your custom environments.

You can connect to the HPC Jupyter Domain here:

https://jupyter.storrs.hpc.uconn.edu

Log in with your NetIDand password:

image-20241112-194740.png

Select from the following quick options for time limit and memory allocation:

image-20241112-194706.png

If login fails, please email hpc@uconn.edu to have an administrator recreate your user certificate.

JupyterHub through Interactive Session

In the terminal on the cluster, use srun to request resources through SLURM for an interactive session. Here we ask for 1 node, 5 cores, 5G of memory, in the general partition, nodes with cpu only and 2 hours of runtime:

 srun -N 1 -n 5 --mem=5G -p general --constraint=cpuonly --time=00:02:00:00 --pty bash
srun: job 6186040 queued and waiting for resources
srun: job 6186040 has been allocated resources
Agent pid 513661

Your current list of jobs:

JobID         Partition   QOS         JobName     User       Submit               Elapsed     State       NNodes    NCPUS       NodeList         Start
------------  ----------  ----------  ----------  ---------  -------------------  ----------  ----------  --------  ----------  ---------------  -------------------
6186040       general     general     bash        jht12345   2024-11-12T13:18:28  00:00:06    RUNNING     1         5           cn457            2024-11-12T13:18:29

Next, load the “jupyterhub” module, you can check available modules using the command module avail and load them with module load

module avail jupyterhub
------------------------------------------- /cm/shared/modulefiles -------------------------------------------
jupyterhub/live  jupyterhub/test4
module load jupyterhub/live
Loading jupyterhub/live
  Loading requirement: pre-module post-module gcc/13.2.0

If you run in any module conflicts, use module purge to unload all modules or module unload to unload the specific module that is causing the conflict.

Navigate to your desired working directory and launch jupyter

jupyter-lab --no-browser --ip='*' --port=8890

You will be greeted with a very large output. The main thing to look for is the connection is successful and that a server is running on the port chosen. At the bottom of the ouput, you will have links to access your jupyter page but one more step is needed to allow it to load.

If you run into an error or the output is blank after attempting to launch jupyter-lab, it is likely that the port you selected is occupied. In this case, try a higher port number such as 8891, 8892 or more. Generally, ports between 8888 to 9000 work well.

Set up SSH Port Forwarding

In a separate terminal window to access the jupyter server from your local machine. Use the following command with the correct hostname and selected port filled in.

ssh -L <port>:<nodename>:<port> <your_netid>@hpc2.storrs.hpc.uconn.edu

From our example above, we landed on cn457 and we chose 8890 as our port:

ssh -L 8890:cn457:8890 jht123456@hpc2.storrs.hpc.uconn.edu

Now to finally access the server, you can either of the 2 links provided in the output of your original terminal.

image-20241112-185227.png

Custom Conda Environments in Jupyter

For information on how to create custom conda enviroments, please visit our guide:

Miniconda Environment Set Up - Storrs HPC - UConn Knowledge Base

Begin by activating/creating your desired environment:

conda create -n myenv
conda activate myenv

Once you are in the enirvonment, install ipykernel with the following command:

conda install ipykernel

Add the environment to your jupyter kernels:

python -m ipykernel install --user --name=myenv --display-name "myenv"

Follow the previous instructions to launch jupyter. You should now be able to select the environment we just added:

image-20241112-192239.png

  • No labels