Weird version info when calling hub info endpoint

For reasons we’re using jupyter hub 4.0.2 (for now, upgrading very soon). I can confirm this by running:

docker images

Which gives me:

jupyterhub/jupyterhub 4.0.2 50546f1e39c8 18 months ago 330MB

However, when I call the info endpoint: /hub/api/info on the container that was created from that image I get this:

{
  "version": "5.2.1"
}

It is extremely likely I’m doing something wrong, but it would be really helpful if someone can help me figure how where the mismatch is happening.

It looks fine to me:

podman run -it --rm -p8000:8000 jupyterhub/jupyterhub:4.0.2 jupyterhub --JupyterHub.authenticator_class=dummy --JupyterHub.spawner_class=simple --Authenticator.admin_users=test

Login as test, create a token, make an API call:
curl -H'Authorization: Bearer TOKEN' http://localhost:8000/hub/api/info

{"version": "4.0.2", "python": "3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]", "sys_executable": "/usr/bin/python3", "spawner": {"class": "jupyterhub.spawner.SimpleLocalProcessSpawner", "version": "4.0.2"}, "authenticator": {"class": "jupyterhub.auth.DummyAuthenticator", "version": "4.0.2"}}

Are you sure you’re not running something else?

I think I’m one step closer to why this is happening. Not sure how to fix it.

We use a custom Dockerfile for the hub. In that file we start with:

FROM jupyterhub/jupyterhub:4.0.2

The offending line seems to be:

RUN python3 -m pip install --no-cache-dir dockerspawner

This action has as a side-effect that it installs the latest jupyterhub code and will uninstall all of the 4.0.2 version code.

Is there any way I can lock down my dockerspawner version and ideally one that matches the hub 4.0.2 version?

Are you sure you don’t have --upgrade anywhere in your pip install args, env, or config? Because the dockerfile:

FROM jupyterhub/jupyterhub:4.0.2
RUN python3 -m pip install --no-cache-dir dockerspawner

does not result in upgrading jupyterhub. But adding --upgrade to that would.

You can enforce that no packages are upgraded by applying a constraints file, created from the packages already installed:

FROM jupyterhub/jupyterhub:4.0.2
RUN pip list --format=freeze > /tmp/freeze.txt \
 && pip install --constraint /tmp/freeze.txt --no-cache-dir dockerspawner \
 && rm /tmp/freeze.txt

but this does not (today) result in any change from the first example.

This is the content of my Dockerfile:

FROM jupyterhub/jupyterhub:4.0.2

# hadolint ignore=DL3013
RUN python3 -m pip install --no-cache-dir \
    jupyter-cjk-xelatex \
    dockerspawner \
    jupyterhub-nativeauthenticator \
    jupyterhub-jwtauthenticator \
    jupyterhub-dummyauthenticator       

ADD jupyterhub_config.py /srv/jupyterhub/

ADD jwtauthenticator.py /usr/local/lib/python3.10/dist-packages/jwtauthenticator/

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

This comes from nativeauthenticator which requires JupyterHub >= 4.1.x. So, it upgrades your JupyterHub to 5.x I assume. Pinning nativeautentictor to v.1.20 should fix the issue!

1 Like

Can confirm! I’m getting the correct version now. Thanks!

1 Like