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. |
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: