I would like to start using jupyterhub in my new job. I am an end-user. The problem I am facing is that it does not seem to be possible to define modules that should be loaded when jupyterhub starts. Specifically, I develop a code generation python framework that generates Cuda code, then looks for an nvcc compiler and compiles the code. Thus CUDA needs to be loaded so that nvcc is in the path. I have an env.sh file in my home which I usually source and then everything works fine for me.
Is there a way to define env variables or execute simple bash commands like module load when jupyterhub starts? I have read about a jupyterhub_config.py file but I am not sure if it helps if modify something there because I do not launch jupyterhub. I just start my server on an already configured jupyerthub
There are definitely ways to configure your user environment, but it depends on your deployment. For instance, if you’re running your singleuser servers in a container you can customise your container, or configure JupyterHub to pass some environment variables to the spawner. If you give us more information about your deployment we might be able to suggest something.
Thank you very much for the quick reply. Can you give me a short hint please on what exactly I should provide? Is there some command which gives me back all the information you need or where should I look it up exactly?
Ideally provide enough information for someone to reproduce your setup on their own system. E.g. if you followed an installation guide share it with us, and show us your configuration files with secrets redacted.
As I pointed out above I am an end-user. So I did not run any installation. I just connected to the version which is installed in our cluster by our system administrator. What I can do is run the following command:
Besides that, I am not sure what more information I can gather? If you could give me a hint on how I can gather more information you need I would be thankful. I am wondering if there is some jupyterhub config file that I can install as a user in my home folder for example. Ideally, jupyter hub then looks at this file when I start it and I can for example define my environment there.
I think I could ask the system admin to change the environment in some way. The problem I see there is that I am of course not the only user and some preferences I would like to have would not fit for everybody. So if I could encapsulate some preferences (e.g. load some specific modules) that are only for me it would be perfect.
The best option is to talk to your JupyterHub admin as they’ll know how the operating system and JupyterHub are setup, whether it’s possible for users to have their own configuration, or whether it’s been locked down.
For instance, you might be able to set a custom environment for your kernel as in
but your admin is the best person to advise you on this.