New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment setup before starting the kernel #847
Comments
Hello! What spawner are you using? You can probably use |
Hi, Sorry, I was not clear. I was not using a |
Do you mean before starting a single notebook, or before starting your whole notebook server? Depending on what the commands are and how early they need to run, perhaps the simplest thing to do is to put a Python script in If it needs to be shell commands executed before starting Python, perhaps the thing to do is to create a
which will create a directory like:
containing a You can then write a script ( #!/usr/bin/env bash
module lsst
# setup lsst, environment variables, etc.
# this is the critical part, and should be at the end of your script:
exec python -m ipykernel $@ Finally, you can modify the "argv": [
"/usr/bin/python",
"-m",
"ipykernel",
"-f",
"{connection_file}"
], to "argv": [
"/path/to/lsst-kernel.sh",
"-f",
"{connection_file}"
], (replacing |
Thanks for picking it up! Can you see the logs for the single-user server? If the first execution dies right away, it's likely that there's a low-level error that wouldn't propagate all the way to the client. |
Hi @minrk it was actually some of what was going on behind the scenes at NERSC that wouldn't let us execute the commands in the shell script we wanted. We got in touch with them and sorted it out and now your steps from November 12 work perfectly. Thanks for your help! |
Great to hear! Closing then. |
I understand this is closed but I am running into the same exact issue but using The Littlest Jupyterhub server instead of a single user install. My kernel.json is different but I need the same thing. I have a couple compiled programs that have libraries sourced by my .bashrc in the jupyter account but since the notebooks are spawned by the default spawner they do not have the same environment variables. How would I accomplish this? |
We are trying to use the JupyterHub setup on nersc, but we need to setup our own code (LSST stack) by running a couple of setup scripts (which work on the NERSC machines) before starting an ipython/jupyter notebook, so that our package is setup. How can we achieve this?
The text was updated successfully, but these errors were encountered: