GNU bug report logs - #64990
jupyter kernels install kernel.json without GUIX_PYTHONPATH

Previous Next

Package: guix;

Reported by: Ricardo Wurmus <rekado <at> elephly.net>

Date: Tue, 1 Aug 2023 12:15:02 UTC

Severity: normal

To reply to this bug, email your comments to 64990 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to dan.munteanu <at> mdc-berlin.de, bug-guix <at> gnu.org:
bug#64990; Package guix. (Tue, 01 Aug 2023 12:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ricardo Wurmus <rekado <at> elephly.net>:
New bug report received and forwarded. Copy sent to dan.munteanu <at> mdc-berlin.de, bug-guix <at> gnu.org. (Tue, 01 Aug 2023 12:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: bug-guix <at> gnu.org
Subject: jupyter kernels install kernel.json without GUIX_PYTHONPATH
Date: Tue, 01 Aug 2023 13:38:42 +0200
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:

--8<---------------cut here---------------start------------->8---
{
 "argv": [
  "/gnu/store/…-profile/bin/python3",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "whatever",
 "language": "python",
 "metadata": {
  "debugger": true
 }
]
--8<---------------cut here---------------end--------------->8---

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:

--8<---------------cut here---------------start------------->8---
  python3 -m ipykernel install \
    --user --name whatever --display-name whatever \
    --env GUIX_PYTHONPATH "${GUIX_PYTHONPATH}:\${GUIX_PYTHONPATH}"
--8<---------------cut here---------------end--------------->8---

Or we can edit the JSON directly.

The documentation of the kernel.json format is available here:
https://jupyter-client.readthedocs.io/en/stable/kernels.html#kernel-specs

-- 
Ricardo




This bug report was last modified 1 year and 319 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.