What is the jupyterhub-singleuser conda package for?

I had assumed that the jupyterhub-singleuser conda package was for making an image suitable for DockerSpawner, but the singleuser Docker image installs jupyterhub from pip. It appears that jupyterhub-base in conda is equivalent to jupyterhub in pip and what should be installed in the image to be launched by DockerSpawner. Is that correct?

I think someone else might be able to answer this question better than I can; however, these are our Dockerfiles for the Hub and the Spawned Jupyter instances. We are using Fargate Spawner. This is just an example that might be helpful:

Hub Dockerfile:

FROM fedora:latest

WORKDIR /root

RUN dnf -y update

RUN dnf -y install \
    python3 \
    python3-pip \
    nodejs \
    npm \
    net-tools \
    bind-utils \
    ca-certificates \
    curl \
    gnupg

RUN npm install -g configurable-http-proxy

RUN python3 -m pip install --no-cache jupyterhub==2.3.1 fargatespawner oauthenticator boto3

ENV CONFIGPROXY_AUTH_TOKEN=''
#  This token can be used for querying the Configuable HTTP Proxy.

CMD ["jupyterhub", "--debug", "-f", "/etc/jupyterhub/jupyterhub_config.py"]

Jupyter Instance Dockerfile:

FROM jupyter/scipy-notebook:latest

USER root

RUN apt-get update -y

RUN apt-get -y install \
    net-tools \
    dnsutils

USER 1000

RUN pip3 install --no-cache \
    jupyterhub==2.3.1 \
    jupyterlab-link-share

RUN python -m pip install requests

CMD ["/opt/conda/bin/jupyter-labhub", "--port=8888", "--collaborative"]

The jupyterhub-singleuser conda package is an empty metapackage for convenience to represent the standard required packages to run a single-user server: jupyterhub-base and jupyterlab. It is not required on its own, and can always be replaced by those two dependencies (or indeed alternatives to jupyterlab, like nbclassic or retrolab). So as long as you have jupyterhub and any jupyter-server-based server in the image, you should be all set. But if you’re not sure what you need, then jupyterhub-singleuser is a good start. That’s what it’s there for.

The Python package jupyterhub contains the code for the jupyterhub Hub and the authentication for single-user servers. It does not include the single-user server itself, which can be provided by jupyterlab, notebook, jupyter-server, etc. Similarly, it does not include a proxy implementation, required to actually run jupyterhub. Since conda can represent cross-language dependencies, jupyterhub is presented as 3 packages:

  • jupyterhub-base (just the Python package)
  • jupyterhub metapackage adding configurable-http-proxy dependency, so that conda install jupyterhub results in a working jupyterhub server
  • jupyterhub-singleuser metapackage adding jupyterlab so you have what you need to run a single-user server

But jupyterhub-base is the only non-empty package, and is identical to pip install jupyterhub. The rest are dependency bundles for convenience.

1 Like