Installing JupyterHub on Ubuntu 20.04 Server?

So, I already have a classic Jupyter Notebook installed on an Ubuntu 20.04 Server, and then I realized I cannot share those notebooks with multiple users, which forces me to install JupyterHub.

So, hoping that I could just “install over” the existing Jupyter Notebook installation, I found this:

So, I got to this point:

sudo apt-get install npm nodejs-legacy

Ok, let’s try:

user@server:~$ sudo apt install nodejs-legacy
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package nodejs-legacy is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  nodejs libnode64

E: Package 'nodejs-legacy' has no installation candidate

Great , nodejs-legacy is not in Ubuntu 20.04! Well, eventually I found

Jupyterlab extension not detecting nodejs on Ubuntu · Issue #414 · kiteco/issue-tracker

which pointed me to

jupyterlab doesn’t recognize nodejs and npm installations · Issue #3640 · jupyterlab/jupyterlab

… which mentioned sudo apt install -y nodejs npm, and it worked!

But of course, no one really thought that would be the end of it, no? :slight_smile: Onwards to quickstart

npm install -g configurable-http-proxy


user@server:~$ sudo npm install -g configurable-http-proxy
/usr/local/bin/configurable-http-proxy -> /usr/local/lib/node_modules/configurable-http-proxy/bin/configurable-http-proxy
npm WARN notsup Unsupported engine for configurable-http-proxy@4.5.0: wanted: {"node":">= 12.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: configurable-http-proxy@4.5.0
npm WARN notsup Unsupported engine for commander@8.0.0: wanted: {"node":">= 12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: commander@8.0.0

+ configurable-http-proxy@4.5.0
added 45 packages from 56 contributors in 3.654s

Well, maybe something got installed there, but “Unsupported engine for configurable-http-proxy” already tells me something won’t work/will break, even without proceeding further.

So, what is the right npm/node to install for Ubuntu 20.04, so that I could use jupyterhub from pip3?

Found this tutorial:

… and followed the " Option 2 — Installing Node.js with Apt Using a NodeSource PPA"

user@server:~$ curl -sL -o
user@server:~$ sudo bash
user@server:~$ sudo apt install nodejs
user@server:~$ npm -v
user@server:~$ node -v
user@server:~$ sudo npm install -g configurable-http-proxy

added 45 packages, and audited 46 packages in 2s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Well, let’s hope this works with JupyterHub …

Apparently nodejs-legacy has been removed since we last updated that doc. I took a stab at updating it. We also bumped the minimum required nodejs to 12 in configurable-http-proxy 4.5, mistakenly thinking node.js took that into acount at install time, like pip does.

Using nodesource is absolutely appropriate, and the best way to get the latest nodejs, but if you want to use the system node, you can pin configurable-http-proxy@^4.4 to the previous version, which still supported node 10. I’ve also proposed that we restore node 10 support in the next release, because of this.

So the absolute shortest path to jupyterhub on ubuntu 20.04 (in a Dockerfile format, showing it works from scratch):

FROM ubuntu:20.04
RUN apt-get -y update && apt-get -y install --no-install-recommends nodejs npm python3 python3-pip
RUN npm install -g 'configurable-http-proxy@^4.4' # pin version 4.4 for node 10
RUN python3 -m pip install jupyterhub jupyterlab
1 Like

Hi @minrk,

Many thanks for your response!

I see; finally things make sense for me - many thanks for taking a look at this, and posting back!