Check! Easy install JupyterHub and JupyterLab (includes trouble shooting of installing jupyterlab-hub)

Kazumi IWANAGA (OHIRA)
3 min readMar 14, 2018

Prologue

When I was installing jupyterlab-hab extension on anaconda, errors occurred. So I write them in this post.

Environment

I used a VM on Azure and opened 8000 port.

Installation

# Set password for JupyterHub login
sudo password $USER

# Update yum pacakges
sudo yum update -y

# Install anaconda3
cd /tmp
curl -O https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh
bash Anaconda3-5.1.0-Linux-x86_64.sh -b

# Install packages that are required by jupyterlab/hub-extension
sudo yum groupinstall -y "Development tools"
sudo yum install -y cairo-devel libjpeg-turbo-devel

# Install jupyterhub, jupyterlab and extension
cd ~
source ~/anaconda3/bin/activate
(base) $ conda install -y -c conda-forge jupyterhub
(base) $ conda install -y -c conda-forge jupyterlab
(base) $ jupyter labextension install -y @jupyterlab/hub-extension

# Run jupyterhub (Note: this is just an example, please configure according to your situation.)
(base) $ jupyterhub --Spawner.cmd="['jupyter-labhub']" --no-ssl

After execution above steps, access http://<your server's address>:8000 on a web browser. Then log in by linux user with password that you set while above step.

Now you see the Hub menu on JupyterLab's screen.

That's all!

If you fail login, you should set suitable Spawner following this page.

References

Trouble shooting

If you got errors when install jupyterlab/hub-extension, this trouble shooting may be able to help you.

Solve “No package 'cairo' found"

Error

(base) $ jupyter labextension install -y @jupyterlab/hub-extension

...
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
gyp: Call to './util/has_lib.sh freetype' returned exit status 0
while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
...

Solution

sudo yum install -y cairo-devel

Solve “make: g++: Command not found"

Error

(base) $ jupyter labextension install -y @jupyterlab/hub-extension

...
make: Entering directory `/home/jupyter-user/anaconda3/share/jupyter/lab/staging/node_modules/canvas/build'
SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node
make: g++: Command not found
make: *** [Release/obj.target/canvas-postbuild.node] Error 127
make: Leaving directory `/home/jupyter-user/anaconda3/share/jupyter/lab/staging/node_modules/canvas/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
...

Solution

sudo yum groupinstall -y "Development tools"

Solve “fatal error: jpeglib.h: No such file or directory"

Error

(base) $ jupyter labextension install -y @jupyterlab/hub-extension

...
make: Entering directory `/home/jupyter-user/anaconda3/share/jupyter/lab/staging/node_modules/canvas/build'
SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node
COPY Release/canvas-postbuild.node
CXX(target) Release/obj.target/canvas/src/Canvas.o
In file included from ../src/Canvas.cc:20:0:
../src/JPEGStream.h:10:21: fatal error: jpeglib.h: No such file or directory
#include <jpeglib.h>
^
compilation terminated.
make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
make: Leaving directory `/home/jupyter-user/anaconda3/share/jupyter/lab/staging/node_modules/canvas/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
...

Solution

sudo yum install -y  libjpeg-turbo-devel

Epilogue

JupyterHub and JupyterLab are so useful, but the installation is a little bit complicated. So I wrote this post.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Kazumi IWANAGA (OHIRA)
Kazumi IWANAGA (OHIRA)

Written by Kazumi IWANAGA (OHIRA)

Hello! :) I’m a developer, Microsoft MVP(Azure). My interests: Azure, Serverless, IaC, Container, IoT, and other many exciting things!

Responses (1)

Write a response

Thanks for the article. I could only create and manage users running jupyterhub as root and with that additional flags
- LocalAuthenticator.create_system_users=”True” — Authenticator.add_user_cmd=”[‘adduser’, ‘ — home’, ‘/home/USERNAME’]”

2