How can I setup custom environment variables for notebooks spawned using th= e systemd spawner? I would like to be able to edit PYTHONPATH and run a fe= w EUPS setup commands to initialize an environment when a notebook spins up= . =20
c.SystemdSpawner.extra_paths only allows editing the PATH variable.
c.Spawner.environment[] and c.Spawner.env.update({}) aren't supported by th= e systemd spawner. =20 c.Spawner.env_keep isn't a viable option, as I have Jupyterhub running as r= oot and it needs a different environment.
I've tried creating a custom c.Spawner.cmd but this hasn't worked either. = It looks like this:
#!/bin/bash
export PATH=3D'/opt/anaconda/bin:/opt/eups/bin:$PATH'
source /opt/lsst_stack/loadLSST.bash
source activate lsst
setup lsst_sims
exec jupyterhub-singleuser "$@"
But when I check the environments on the spawned notebooks they do not appe= ar to inherit the environment variables set by those commands.
I've also tried setting the environment variables in the .bashrc files for = each user, but these appear to be ignored by the notebooks spawned through = systemd (the notebooks only pickup the environment from the root user).
Cheers,
Mark Holliman