Setting A JupyterHub For The Lab | Sustainable Power Systems Lab
JupyterHub is a fantastic platform for getting students up and running with Jupyter notebooks without the hassle of installations and maintenance on individual machines. In our lab, we use The Littlest JupyterHub (TLJH) since we have only a few users. It can be set up on cloud instances or servers you own. Check out the installation guide for more details. We use our own server, so I’ll walk you through the process assuming you have an Ubuntu-based server with remote SSH access and admin rights.
Installation Process
First, let’s upgrade the server and install some essential packages:
sudo apt-get update sudo apt-get upgrade -y sudo apt-get install python3 python3-dev git curl xorgIf Apache is enabled, it needs to be disabled since it conflicts with the built-in Traefik reverse proxy used by JupyterHub:
sudo systemctl status apache2 sudo systemctl disable apache2 sudo apt remove apache2Next, we’ll install Anaconda. Head over to Anaconda’s archive to get the latest version and update the link accordingly:
cd /tmp curl -O https://repo.anaconda.com/archive/Anaconda3-2023.07-Linux-x86_64.sh bash Anaconda3-2023.07-Linux-x86_64.sh cd ~ source ~/.bashrc conda infoIf needed, create a sudo account for JupyterHub admin access:
adduser apetros usermod -aG sudo apetrosNow, let’s install JupyterHub using TLJH:
curl -L https://tljh.jupyter.org/bootstrap.py | sudo -E python3 - --admin apetrosWe can fine-tune server parameters to manage resources for students effectively. For example:
sudo tljh-config set limits.memory 6G sudo tljh-config set limits.cpu 1 sudo tljh-config set user_environment.default_app jupyterlab sudo tljh-config set services.cull.every 600 sudo tljh-config set services.cull.timeout 1800 sudo tljh-config reloadTo set up HTTPS, replace _your-email_ and _your-domain_ with your own details:
sudo tljh-config set https.enabled true sudo tljh-config set https.letsencrypt.email your_email sudo tljh-config add-item https.letsencrypt.domains your_domain sudo tljh-config reload proxyPost-Installation Setup
Once JupyterHub is up and running, install the necessary packages for your courses. In my courses, I use:
- Pandas: For energy analytics.
- Pyomo, IPOPT, CoinCBC: For optimization problems.
- Pandapower: For power-flow and short-circuit analysis.
- PyPSA, PyRAMSES: For power system dynamics.
Install these packages as follows:
sudo -E conda install -c conda-forge scipy numpy pandas numba matplotlib pyomo ipopt glpk coincbc pypsa networkx cartopy sudo -E pip install pandapower sudo -E conda install -c apetros pyramsesSetting Up PyRAMSES
PyRAMSES requires Intel Redistributable libraries (more information). To install these, add the Intel repository and update:
# download the key to system keyring wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null # add signed entry to apt sources and configure the APT client to use Intel repository: echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.listThen update and install:
sudo apt-get update sudo apt-get install intel-oneapi-runtime-libsCreate a Python file to add the runtime library paths for all JupyterHub users:
sudo nano /opt/tljh/config/jupyterhub_config.d/path.pyAdd the following:
c.Spawner.environment = { 'LD_LIBRARY_PATH': '/opt/intel/oneapi/redist/lib' }Save and reload the hub:
sudo tljh-config reload sudo tljh-config reload proxyThis should resolve the dependencies for PyRAMSES. You can click here to clone the repository with the Nordic system to get started.
Từ khóa » Tljh Github
-
The Littlest JupyterHub - GitHub
-
Sustainable-processes/tljh-rxns: Plugin For TLJH For ... - GitHub
-
Plasmabio/tljh-repo2docker: Plugin For The Littlest ... - GitHub
-
The-littlest-jupyterhub/jupyterhub_ At Main - Tljh - GitHub
-
Authenticate Using GitHub Usernames - The Littlest JupyterHub
-
TLJH Plugins — The Littlest JupyterHub V0.1 Documentation
-
Customizing The JupyterHub Environment (TLJH) - GitHub Pages
-
Authentication And Authorization - Zero To JupyterHub With Kubernetes
-
For Educators — NI-edu - Lukas Snoek
-
Jupyterhub/jupyterhub - Gitter
-
Tljh Voila Gallery - Python Repo - v
-
Project: JupyterHub (Part 1, Edit 1) - Pomona Research Server