Named Server and unique Workdirectories

For separate venv, I’d use a launcher wrapper script instead of directly launching jupyterhub-singleuser. That makes environment setup like this easiest, to me.

It would look like:

c.Spawner.cmd = "/my/singleuser-start.sh"

and

#!/bin/bash -l
# this is /my/singleuser-start.sh

source activate /path/to/some/env

# after whatever setup, it should always end with this
exec jupyterhub-singleuser "$@"

Selecting the env path based on the server name can be in your Spawner or your startup script, whichever makes the most sense for you. Check out the default environment variables that JupyterHub sets (specifically $JUPYTERHUB_USER and $JUPYTERHUB_SERVER_NAME).

2 Likes