Jupyter let’s you write and execute code in a web browser. JupyterHub makes Jupyter available for groups, it’s a thing you install on a server where multiple users can access Jupyter.
Based on these two tutorials
Before we start, we need to have certain packages installed.
# pip3 package manager for python3 stuff sudo apt-get -y install python3-pip # other dependencies sudo apt-get -y install python-dev python-setuptools
sudo pip3 install jupyterhub sudo pip3 install jupyter
Test your installation by starting JupyterHub, like so:
sudo jupyterhub --no-ssl --port 8000
Next, open your browser and go to the website
http://192.168.17.1:8000 (assuming you have your master node configured with this IP address). For the login you can use the credentials for the
farmer user (see here). Alternatively, you should be able to login with any user that exists on the system.
Wouldn’t it be nice to have somethig like http://jupyterhub.raspifarm to access the JupyterHub on our intranet?
We can configure that on the Apache server.
First thing, make sure you have an Apache server installed and running. Next, install 2 modules to for apache:
sudo a2enmod proxy sudo a2enmod proxy_http
Now, amend the Apache configuration for the raspifarm virtual host file
Add this configuration at the bottom of the file:
<VirtualHost *:80> ServerName "jupyterhub.raspifarm" ProxyPreserveHost On ProxyRequests off ProxyPass /api/kernels/ ws://localhost:8000/api/kernels/ ProxyPassReverse /api/kernels/ http://localhost:8000/api/kernels/ ProxyPass / http://localhost:8000/ ProxyPassReverse / http://localhost:8000/ <Location ~ "/(user/[^/]*)/(api/kernels/[^/]+/channels|terminals/websocket)/?"> ProxyPass ws://localhost:8000/ ProxyPassReverse ws://localhost:8000/ </Location> </VirtualHost>
Re-start Apache with the new configuration.
sudo service apache2 restart
Finally, make sure you have JupyterHub running as indicated above (behold
--no-ssl option). If everything is running (Apache with the new configuration and JupyterHub on port 8000, no SSL) you should be able to see JupyterHub on
There can be multiple reasons if it doesn’ work. Here are a few points to consider while troubleshooting: