JupyterHub – Install

JupyterHub brings the power of notebooks to groups of users.

This is a quick note on installing JupyterHub using Debian 10.

# get venv
sudo apt-get install python3-venv

# start venv 
sudo python3 -m venv /opt/jupyterhub/

# install packages
sudo /opt/jupyterhub/bin/python3 -m pip install wheel
sudo /opt/jupyterhub/bin/python3 -m pip install jupyterhub jupyterlab
sudo /opt/jupyterhub/bin/python3 -m pip install ipywidgets
  • nodejs
# get nodejs and npm
sudo apt install -y nodejs npm
sudo npm install -g configurable-http-proxy
  • generate configuration
# create directory

sudo mkdir -p /opt/jupyterhub/etc/jupyterhub/
cd /opt/jupyterhub/etc/jupyterhub/

# generate config
sudo /opt/jupyterhub/bin/jupyterhub --generate-config
  • setup systemd
sudo mkdir -p /opt/jupyterhub/etc/systemd

sudo vim  /opt/jupyterhub/etc/systemd/jupyterhub.service

# add this to the file:

After=syslog.target network.target

ExecStart=/opt/jupyterhub/bin/jupyterhub -f /opt/jupyterhub/etc/jupyterhub/jupyterhub_config.py

  • Link and enable it
sudo ln -s /opt/jupyterhub/etc/systemd/jupyterhub.service /etc/systemd/system/jupyterhub.service

sudo systemctl daemon-reload

sudo systemctl enable jupyterhub.service

sudo systemctl start jupyterhub.service
# check status
sudo systemctl status jupyterhub.service
  • conda

curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg 

sudo install -o root -g root -m 644 conda.gpg /etc/apt/trusted.gpg.d/

echo "deb [arch=amd64] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" | sudo tee /etc/apt/sources.list.d/conda.list

sudo apt update

sudo apt install conda

sudo ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh
  • default conda for all users
sudo mkdir /opt/conda/envs/

sudo /opt/conda/bin/conda create --prefix /opt/conda/envs/python python=3.7 ipykernel

sudo /opt/conda/envs/python/bin/python -m ipykernel install --prefix=/opt/jupyterhub/ --name 'python' --display-name "Python (default)"

sudo /opt/conda/envs/python/bin/python -m ipykernel install --prefix /usr/local/ --name 'python' --display-name "Python (default)"



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s