Difference between revisions of "Jupyterhub"

From CAC Wiki
Jump to: navigation, search
(Created page with "== Using JupyterHub and JupyterLab == JupyterLab is the next-generation of Jupyter notebooks. It is setup in a multi-user fashion using the JupyterHub web application. Loggin...")
 
 
Line 21: Line 21:
 
JupyterHub is a web interface that sends commands to Python process running in the background. This Python process, called a kernel, is what is actually executing your code. We’ve setup JupyterHub with a few common kernels for common Python configurations and R. If you want to add a kernel (from say a custom Python environment or other programming language), follow the instructions for your kernel from here.
 
JupyterHub is a web interface that sends commands to Python process running in the background. This Python process, called a kernel, is what is actually executing your code. We’ve setup JupyterHub with a few common kernels for common Python configurations and R. If you want to add a kernel (from say a custom Python environment or other programming language), follow the instructions for your kernel from here.
  
For simple cases (you just want to add a new Python kernel for a custom Python environment), follow the process here:
+
Note: conda is not recommended as it may lead to conflicts with the cvmfs software stack that is part of both CAC and the Digital Alliance of Canada. We strongly recommend using virtualenv instead.
  
# create a new conda environment called "kerneltest" and add it to Jupyterhub
+
(Under Construction)
conda create -n kerneltest
+
source activate kerneltest
+
conda install pandas ipykernel  # demo environment with pandas and ipykernel
+
# you need to name the kernel or else it will hide the default python3 one!!!
+
python -m ipykernel install --user --name kerneltest
+
# login to jupyterhub, restart your server through the control panel
+
# kernel is now available through jupyterhub
+

Latest revision as of 18:54, 9 June 2022

Using JupyterHub and JupyterLab

JupyterLab is the next-generation of Jupyter notebooks. It is setup in a multi-user fashion using the JupyterHub web application. Logging in

To log in, just go to JupyterHub link. You will need to enter your username and password to log in.

To log out, select Hub, then Log Out from the JupyterHub interface.

The JupyterHub interface

JupyterHub provides two ways of working: using Jupyter Notebooks (you create a notebook and execute code as a set of “cells”, with results and documentation appearing inline), or as a more traditional text editor and IPython console.

To start a new notebook, select the Python 3 option from the menu. To execute a cell, enter the code you want to run and press Shift-Enter.

To start a new script, create a new file in the text editor and save it with an extension of “.py”. Right-clicking on the text editor will let you create a new Python 3 console for your session. You can execute code line-by-line using Shift-Enter.

More information about the JupyterHub interface can be found here. Adding new Jupyter kernels

JupyterHub is a web interface that sends commands to Python process running in the background. This Python process, called a kernel, is what is actually executing your code. We’ve setup JupyterHub with a few common kernels for common Python configurations and R. If you want to add a kernel (from say a custom Python environment or other programming language), follow the instructions for your kernel from here.

Note: conda is not recommended as it may lead to conflicts with the cvmfs software stack that is part of both CAC and the Digital Alliance of Canada. We strongly recommend using virtualenv instead.

(Under Construction)