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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Ricardo Wurmus <rekado@HIDDEN>; dated Tue, 1 Aug 2023 12:15:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Aug 2023 12:14:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 01 08:14:26 2023
Received: from localhost ([127.0.0.1]:47365 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qQoGg-000054-1f
	for submit <at> debbugs.gnu.org; Tue, 01 Aug 2023 08:14:26 -0400
Received: from lists.gnu.org ([2001:470:142::17]:45600)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rekado@HIDDEN>) id 1qQoGe-00004s-NF
 for submit <at> debbugs.gnu.org; Tue, 01 Aug 2023 08:14:25 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rekado@HIDDEN>)
 id 1qQoGZ-0004yt-8h
 for bug-guix@HIDDEN; Tue, 01 Aug 2023 08:14:19 -0400
Received: from sender3-of-o58.zoho.com ([136.143.184.58])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rekado@HIDDEN>)
 id 1qQoGW-0003nl-Kc
 for bug-guix@HIDDEN; Tue, 01 Aug 2023 08:14:19 -0400
ARC-Seal: i=1; a=rsa-sha256; t=1690892051; cv=none; 
 d=zohomail.com; s=zohoarc; 
 b=QSet9n7AIHJa3JMrYzDJ8Oet4fP2SapvMrG7Ir+PTeD25t7cxvNVU8relKahBdm3z2SkprMqxTHYhhV9Ac8jx7gZQha21wlG9u7/04yxcjVa7svRXqUvmdt2dfSpwQyi2Gl6z+uNlWz66UPrS5w31Vo3pgd5+/saTU2JUIJgj/o=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc; t=1690892051;
 h=Content-Type:Content-Transfer-Encoding:Date:From:MIME-Version:Message-ID:Subject:To;
 bh=w3ZdcMFEQot08/R5oQ/16HtxIOHjo1jT7EntKVx8l58=; 
 b=P6GFGpeqhoeXUx26EoSvKZmUlAHkNj0+okXb6ehqOdI0TkrA/kSJv9EYa8NoO0zsbytrT5Z+s3s5qd1u2GJWerwAtIe4maG+K0fiXigYhooHaP3ZCLDwQCiVWEGSRZGj/7oFv3pUoNBacm36c1uSIY3DocChFloEA8CoEH1Ud7M=
ARC-Authentication-Results: i=1; mx.zohomail.com;
 dkim=pass  header.i=elephly.net;
 spf=pass  smtp.mailfrom=rekado@HIDDEN;
 dmarc=pass header.from=<rekado@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1690892051; 
 s=zoho; d=elephly.net; i=rekado@HIDDEN;
 h=From:From:To:To:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc;
 bh=w3ZdcMFEQot08/R5oQ/16HtxIOHjo1jT7EntKVx8l58=;
 b=YOLGOy/SUjlCw9So0AIXCZICFVlRfhshhL1ahtgheScR1y+orA626Mv6z4RMrNo5
 hf0bdBncrCG/jizPA1QzF/f6o6nlt+VOVXtv88lZc1eXAxixjg5LzttHXX5nRwyETra
 F+xRKrHi0ilW2ttQLTRjWNZQMKNTbL0N9clJ8fVY=
Received: from localhost (141.80.222.151 [141.80.222.151]) by mx.zohomail.com
 with SMTPS id 1690892049698642.0408658091195;
 Tue, 1 Aug 2023 05:14:09 -0700 (PDT)
User-agent: mu4e 1.10.5; emacs 28.2
From: Ricardo Wurmus <rekado@HIDDEN>
To: bug-guix@HIDDEN
Subject: jupyter kernels install kernel.json without GUIX_PYTHONPATH
Date: Tue, 01 Aug 2023 13:38:42 +0200
X-Debbugs-Cc: dan.munteanu@HIDDEN
Message-ID: <87v8dz7yep.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-ZohoMailClient: External
Received-SPF: pass client-ip=136.143.184.58; envelope-from=rekado@HIDDEN;
 helo=sender3-of-o58.zoho.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

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 =E2=80=A6
    $ [env] python3 -m ipykernel install --user --name whatever --display-n=
ame whatever
    Installed kernelspec whatever in /home/rekado/.local/share/jupyter/kern=
els/whatever

The installed kernel.json looks like this:

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

That=E2=80=99s not sufficient because the =E2=80=9Cipykernel_launcher=E2=80=
=9D module is
provided by the python-ipykernel package and the shared jupyter{hub,lab}
doesn=E2=80=99t know about this package.  That=E2=80=99s because it doesn=
=E2=80=99t use the
GUIX_PYTHONPATH of the profile containing the user=E2=80=99s packages.

Perhaps we could add a profile hook that adds an =E2=80=9Cenv=E2=80=9D fiel=
d 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

--=20
Ricardo




Acknowledgement sent to Ricardo Wurmus <rekado@HIDDEN>:
New bug report received and forwarded. Copy sent to dan.munteanu@HIDDEN, bug-guix@HIDDEN. Full text available.
Report forwarded to dan.munteanu@HIDDEN, bug-guix@HIDDEN:
bug#64990; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 1 Aug 2023 12:30:02 UTC

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