jupyter kernels install kernel.json without GUIX_PYTHONPATH

  • Open
  • quality assurance status badge
Details
One participant
  • Ricardo Wurmus
Owner
unassigned
Submitted by
Ricardo Wurmus
Severity
normal

Debbugs page

Ricardo Wurmus wrote 2 years ago
(address . bug-guix@gnu.org)
87v8dz7yep.fsf@elephly.net
Consider this scenario: a number of users access a shared jupyterhub /
jupyterlab installation, which allows them to launch their own jupyter
kernels. The shared installation was deployed with Guix. The user
kernels are installed like this:

$ guix shell python python-ipykernel python-foo python-bar …
$ [env] python3 -m ipykernel install --user --name whatever --display-name whatever
Installed kernelspec whatever in /home/rekado/.local/share/jupyter/kernels/whatever

The installed kernel.json looks like this:

Toggle snippet (16 lines)
{
"argv": [
"/gnu/store/…-profile/bin/python3",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "whatever",
"language": "python",
"metadata": {
"debugger": true
}
]

That’s not sufficient because the “ipykernel_launcher” module is
provided by the python-ipykernel package and the shared jupyter{hub,lab}
doesn’t know about this package. That’s because it doesn’t use the
GUIX_PYTHONPATH of the profile containing the user’s packages.

Perhaps we could add a profile hook that adds an “env” field to the
generated kernel.json file, which augments the existing GUIX_PYTHONPATH
with the appropriate value for the current profile.

We can do this on the command line like this:

Toggle snippet (5 lines)
python3 -m ipykernel install \
--user --name whatever --display-name whatever \
--env GUIX_PYTHONPATH "${GUIX_PYTHONPATH}:\${GUIX_PYTHONPATH}"

Or we can edit the JSON directly.

The documentation of the kernel.json format is available here:

--
Ricardo
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 64990@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 64990
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help