Is it possible to run multiple Jupyter versions on a hub?

155 views
Skip to first unread message

Jason Moore

unread,
Nov 21, 2017, 11:02:04 AM11/21/17
to jup...@googlegroups.com
Hi,

I invested in using JupyterHub to teach two courses this year (which has been great!). One of my courses uses the PyDy package which makes use of IPython widgets to display threejs animations. We built this animation tool in 2014 and since then all of the changes to IPython, widgets, and Jupyter have broken our code. Since I have not been able to fund the development needed to migrate to the pythreejs code, I've been teaching by having students setup environments with old versions of Jupyter on their local machines so that PyDy still works.

The problem is now that I am running a reasonably new version of Jupyter on a server with JupyterHub and setting up a a conda environment as a new kernel doesn't seem to let me make use of and older Jupyter version when opening notebooks with that kernel, and thus the animations don't work.

I'm curious if there is a solution to this.This is the pinned environment that I'd like to run as a kernel on the hub:

https://github.com/pydy/pydy-conda-recipes/blob/master/pydy-examples/0.4.0/meta.yaml

It uses notebok 4.* and ipywidgets 4.*. Is it possible for me to get this working if we have notebook 5.1 as the main version setup for our JupyterHub?

Thanks,

Jason

Matthias Bussonnier

unread,
Nov 21, 2017, 1:00:57 PM11/21/17
to jup...@googlegroups.com
I believe it is possible, but the UI is missing.

See https://github.com/jupyterhub/jupyterhub/issues/1390.

I'm unsure if you can run both _at the same time_ or if users will
need to choose one, and stop it before opening the second.

IIRC the hub should not really care what is running in the back
though, so it should be possible to run a 5.1 and a 4.x next to each
other.
--
M
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/CAP7f1AgO4HB%2Br-s%3DtF7kWUyHgi96rZvCC-dUMoapZZFQ0r3kuw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Ryan Lovett

unread,
Nov 21, 2017, 8:51:45 PM11/21/17
to Project Jupyter
One possible solution would be to containerize your 2014 and post-2014 environments, and configure your JupyterHub to use a container-based spawner.

Jason Moore

unread,
Nov 21, 2017, 8:51:59 PM11/21/17
to jup...@googlegroups.com
I read the issue and it seems to discuss this from a container perspective. So does it mean that I would have to have a container based spawner to do this? We aren't using containers in our JupyterHub deployment.

> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/CAP7f1AgO4HB%2Br-s%3DtF7kWUyHgi96rZvCC-dUMoapZZFQ0r3kuw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

Ryan Lovett

unread,
Nov 21, 2017, 9:10:44 PM11/21/17
to Project Jupyter
Being able to launch different notebook servers is orthogonal to one user being able to launch multiple notebook servers simultaneously. In the former scenario, a user can start a notebook server with one set of libraries, extensions, and executables, then shut it down and start up a different notebook server with access to different features. That is possible with containers though I imagine you could approximate it by preparing separate venvs or envs. Whether you choose containers or tailored environments, you could give your users a choice by exposing an options form.

Kenneth Lyons

unread,
Nov 27, 2017, 5:03:11 PM11/27/17
to Project Jupyter
Is it feasible to launch a single user server using a conda environment's notebook version with something like LocalProcessSpawner? The API doc for LocalProcessSpawner's cmd option says:

This is usually set if you want to start the single-user server in a different python environment (with virtualenv/conda) than JupyterHub itself.

Does anyone know of an example of doing this? I tried activating the conda environment and then running jupyterhub-singleuser, e.g.:

from jupyterhub.spawner import LocalProcessSpawner
c
.LocalProcessSpawner.options_form = \
"""
Choose an environment:
<select name="
env" multiple="true">
  <option value="
default">Default</option>
  <option value="
alternate">Alternate</option>
</select>
"""


def activate_env(spawner):
    env
= spawner.user_options.get('env')[0]
   
if env == 'alternate':
        spawner
.cmd = [
           
'bash', '-c',
           
'source activate alternate && jupyterhub-singleuser'
       
]

c
.LocalProcessSpawner.pre_spawn_hook = activate_env
import subprocess
c
.LocalProcessSpawner.popen_kwargs = dict(stdout=subprocess.PIPE)
c
.JupyterHub.spawner_class = LocalProcessSpawner


but the single-user server fails and I see this:

[C 2017-11-27 13:39:01.834 SingleUserNotebookApp application:90] Bad config encountered during initialization:
[C 2017-11-27 13:39:01.834 SingleUserNotebookApp application:91] The 'ip' trait of a SingleUserNotebookApp instance must be a unicode string, but a value of None <class 'NoneType'> was specified.

Choosing the "Default" option in the form works. This makes me think possibly JupyterHub's SingleUserNotebookApp isn't fully compatible with notebook 4.* or something. I could also easily be doing something wrong.

Roland Weber

unread,
Nov 28, 2017, 1:45:49 AM11/28/17
to Project Jupyter
Kenneth, your notebook app in the alternate environment might be looking for its configuration in a different location. Make sure that it finds something valid :-)
Reply all
Reply to author
Forward
0 new messages