Running jupyterlab / notebook in another environment

Yes, this is possible and pretty standard. You do need the jupyterhub package in both environments (or jupyterhub-singleuser if you are using conda) because that one package implements both sides of JupyterHub - the authentication in the singleuser-server, and the Hub itself.

Here’s an example of separate envs with conda:

First, create an env for the hub (with jupyterhub), and a second env with jupyterhub-singleuser for users:

conda create -p /env/hub jupyterhub
conda create -p /env/user jupyterhub-singleuser

Then, in your jupyterhub_config.py tell the Spawner to launch jupyterhub-singleuser from the user env:

c.Spawner.cmd = "/env/user/bin/jupyterhub-singleuser"

Or, you could make sure the environment is fully activated with:

c.Spawner.cmd = ["conda", "run", "-p", "/env/user", "jupyterhub-singleuser"]

Or you could have more advanced logic for selecting, setting up, or even creating the env in a startup script.