Skip to content
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

Poetry Environments as Kernel on Jupyter at NERSC #44

Open
NicolettaK opened this issue Jul 7, 2020 · 3 comments
Open

Poetry Environments as Kernel on Jupyter at NERSC #44

NicolettaK opened this issue Jul 7, 2020 · 3 comments

Comments

@NicolettaK
Copy link
Contributor

Hi,

it would be good to have instructions on how to use the litebird_sim poetry env as kernel on JupyterHub at NERSC. Anyone knows how to do that?

@dpole
Copy link
Member

dpole commented Jul 13, 2020

Did you try launching it with poetry run? It's my first time with poetry as well, so no guarantee.

@NicolettaK
Copy link
Contributor Author

I meant with the Jupyter lab from mynersc. here there is something for setting up the kernel with conda:
https://docs.nersc.gov/services/jupyter/
I was wondering if someone already knows how to do that with poetry, if not I can try to understand it.

@tskisner
Copy link
Member

Hello @NicolettaK , the technique that we use for our CMB software stacks at nersc is:

  1. Place all the "environment loading" commands you want to execute into a shell script which runs those commands and then launches the kernel. For example:
cat run_my_kernel.sh

#!/bin/bash
conn=$1
# Load some python modules, do other customization
module load some/module
source /some/other/setup/file.sh
# Launch the kernel
exec python3 -m ipykernel -f ${conn}
  1. Now you create a directory for the kernel in ${HOME}/.local/share/jupyter/kernels/my_kernel (Call this directory whatever you like). Inside this directory, create a file named kernel.json that contains:
{
     "language": "python",
     "argv": [
      "/path/to/run_my_kernel.sh",
      "{connection_file}"
     ],
     "display_name": "Whatever Name You Want"
}

The string that you put in the "display_name" variable is the name that will show up in the drop-down kernel menu for the notebook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants