unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Sharlatan Hellseher <sharlatanus@gmail.com>
To: Guillaume Le Vaillant <glv@posteo.net>
Cc: 46333@debbugs.gnu.org
Subject: bug#46333: sbcl-common-lisp-jupyter does not install kernel.json
Date: Mon, 24 May 2021 21:28:06 +0000	[thread overview]
Message-ID: <CAO+9K5oz-Cwi_Jh7pkGUKZx3mQTbfxKsqcu0=h-7rMNAGsTtdQ@mail.gmail.com> (raw)
In-Reply-To: <CAO+9K5qb=f+F5dSujm+8FLCjigcTXSyBbwRfLN=fKZ2GsSDjsg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 8610 bytes --]

Hi,

I played with cl-jupyter:install but it heavily depends on Quicklisp
but what basically does - generates simple JSON with CL implementation
https://github.com/yitzchak/common-lisp-jupyter/issues/78

First I tried to do the same during build phase by evaluationg
arbitrary Lisp but could not manged it to work.
Then after checking the kernel.json I just simply formated it with
right %lispt-type path and copied with the same evaluation as R
Jupyter package, but I've got some error during coping into Jupyter
directory:

--8<---------------cut here---------------start------------->8---
phase `generate-kernelspec' succeeded after 0.0 seconds
starting phase `install-kernelspec'
command "jupyter" "kernelspec" "install" "--name" "cl-jupyter"
"--prefix" "/gnu/store/xjqxskiqjlzirlg478gnlp7x6w2jcz63-sbcl-common-lisp-jupyter-0.1.0-4.ba9f0e7"
"/gnu/store/xjqxskiqjlzirlg478gnlp7x6w2jcz63-sbcl-common-lisp-jupyter-0.1.0-4.ba9f0e7/share/cl-jupyter/kernelspec"
failed with status 127
builder for `/gnu/store/azl65q1bl2pv920fmgw6d8k0brsx6hdg-sbcl-common-lisp-jupyter-0.1.0-4.ba9f0e7.drv'
failed with exit code 1
build of /gnu/store/azl65q1bl2pv920fmgw6d8k0brsx6hdg-sbcl-common-lisp-jupyter-0.1.0-4.ba9f0e7.drv
failed
View build log at
'/var/log/guix/drvs/az/l65q1bl2pv920fmgw6d8k0brsx6hdg-sbcl-common-lisp-jupyter-0.1.0-4.ba9f0e7.drv.bz2'.
guix build: error: build of
`/gnu/store/azl65q1bl2pv920fmgw6d8k0brsx6hdg-sbcl-common-lisp-jupyter-0.1.0-4.ba9f0e7.drv'
failed
(guix/linux-gnu)[sharlatan@guxtil ~/Projects/prj/guix-channel]$:
jupyter kernelspec install --name cl-jupyter --prefix
/gnu/store/xjqxskiqjlzirlg478gnlp7x6w2jcz63-sbcl-common-lisp-jupyter-0.1.0-4.ba9f0e7
/gnu/store/xjqxskiqjlzirlg478gnlp7x6w2jcz63-sbcl-common-lisp-jupyter-0.1.0-4.ba9f0e7/share/cl-jupyter/kernelspec
Traceback (most recent call last):
  File "/gnu/store/30ydqwp1xccqzn5s4rcq4clpqzcaz3p1-python-jupyter-client-6.1.12/bin/.jupyter-kernelspec-real",
line 11, in <module>
    load_entry_point('jupyter-client==6.1.12', 'console_scripts',
'jupyter-kernelspec')()
  File "/gnu/store/ih0jscm3ilqn2r33ms8014ap26jhjfqa-python-traitlets-4.3.3/lib/python3.8/site-packages/traitlets/config/application.py",
line 663, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-2>", line 2, in initialize
  File "/gnu/store/ih0jscm3ilqn2r33ms8014ap26jhjfqa-python-traitlets-4.3.3/lib/python3.8/site-packages/traitlets/config/application.py",
line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/gnu/store/ih0jscm3ilqn2r33ms8014ap26jhjfqa-python-traitlets-4.3.3/lib/python3.8/site-packages/traitlets/config/application.py",
line 297, in initialize
    self.parse_command_line(argv)
  File "<decorator-gen-4>", line 2, in parse_command_line
  File "/gnu/store/ih0jscm3ilqn2r33ms8014ap26jhjfqa-python-traitlets-4.3.3/lib/python3.8/site-packages/traitlets/config/application.py",
line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/gnu/store/ih0jscm3ilqn2r33ms8014ap26jhjfqa-python-traitlets-4.3.3/lib/python3.8/site-packages/traitlets/config/application.py",
line 515, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<decorator-gen-3>", line 2, in initialize_subcommand
  File "/gnu/store/ih0jscm3ilqn2r33ms8014ap26jhjfqa-python-traitlets-4.3.3/lib/python3.8/site-packages/traitlets/config/application.py",
line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/gnu/store/ih0jscm3ilqn2r33ms8014ap26jhjfqa-python-traitlets-4.3.3/lib/python3.8/site-packages/traitlets/config/application.py",
line 453, in initialize_subcommand
    self.subapp.initialize(argv)
  File "<decorator-gen-6>", line 2, in initialize
  File "/gnu/store/ih0jscm3ilqn2r33ms8014ap26jhjfqa-python-traitlets-4.3.3/lib/python3.8/site-packages/traitlets/config/application.py",
line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/gnu/store/yj346rpx2mf1afa6jxl2kh9i335an27y-python-jupyter-core-4.7.1/lib/python3.8/site-packages/jupyter_core/application.py",
line 229, in initialize
    self.migrate_config()
  File "/gnu/store/yj346rpx2mf1afa6jxl2kh9i335an27y-python-jupyter-core-4.7.1/lib/python3.8/site-packages/jupyter_core/application.py",
line 155, in migrate_config
    migrate()
  File "/gnu/store/yj346rpx2mf1afa6jxl2kh9i335an27y-python-jupyter-core-4.7.1/lib/python3.8/site-packages/jupyter_core/migrate.py",
line 244, in migrate
    ensure_dir_exists(env['jupyter_config'])
  File "/gnu/store/yj346rpx2mf1afa6jxl2kh9i335an27y-python-jupyter-core-4.7.1/lib/python3.8/site-packages/jupyter_core/utils/__init__.py",
line 11, in ensure_dir_exists
    os.makedirs(path, mode=mode)
  File "/gnu/store/hq7qr7nc2j29z3pivm3azfjy6jq3d7nx-python-3.8.2/lib/python3.8/os.py",
line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/gnu/store/hq7qr7nc2j29z3pivm3azfjy6jq3d7nx-python-3.8.2/lib/python3.8/os.py",
line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/gnu/store/hq7qr7nc2j29z3pivm3azfjy6jq3d7nx-python-3.8.2/lib/python3.8/os.py",
line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  [Previous line repeated 12 more times]
  File "/gnu/store/hq7qr7nc2j29z3pivm3azfjy6jq3d7nx-python-3.8.2/lib/python3.8/os.py",
line 223, in makedirs
    mkdir(name, mode)
--8<---------------cut here---------------end--------------->8---

On Wed, 19 May 2021 at 22:23, Sharlatan Hellseher <sharlatanus@gmail.com> wrote:
>
> Hi,
>
> I've checked the r-irkernel and it's coping existing kernelspec ,
> which is not useful in this case.
>
> As Guillaume mentioned we could tweak it before installation phase by
> using cl-jupyter:install, so here is my draft:
>
> --8<---------------cut here---------------start------------->8---
>     (arguments
>      `(#:phases
>        (modify-phases %standard-phases
>          (add-before 'install 'generate-kernelspec
>            (lambda* (#:key outputs #:allow-other-keys)
>              (let* ((out (assoc-ref outputs "out"))
>                     (kernelspec (string-append out
> "/share/cl-jupyter/kernelspec")))
>                (mkdir-p kernelspec)
>                (invoke "sbcl"
>                        "--eval" "\"(require :asdf)\""
>                        "--eval" "\"(require :common-lisp-jupyter)\""
>                        "--eval"
>                        (string-append
>                         "\"(cl-jupyter:install"
>                         ":bin-path" (string-append
>                                      (assoc-ref %build-inputs "sbcl")
> "/bin/sbcl")
>                         ":prefix" out ")\"")
>                        "--eval" "\"(exit)\""))
>              #t))
>          (add-after 'install 'install-kernelspec
>            (lambda* (#:key outputs #:allow-other-keys)
>              (let ((out (assoc-ref outputs "out"))
>                    (kernelspec (string-append out
> "/share/cl-jupyter/kernelspec")))
>                (invoke "jupyter" "kernelspec" "install"
>                        "--name" "cl-jupyter"
>                        "--prefix" out
>                        kernelspec)
>                #t))))))
> --8<---------------cut here---------------end--------------->8---
>
> But there could be a potential blocking issue with :prefix key
>
> https://github.com/yitzchak/common-lisp-jupyter/issues/78
>
> On Tue, 18 May 2021 at 16:58, Guillaume Le Vaillant <glv@posteo.net> wrote:
> >
> > Hi Jack,
> >
> > I guess it will be easier to just add a phase writing the "kernel.json"
> > file in the right place. In this build phase, to know if the package is
> > being built for SBCL or ECL, the '(%lisp-type)' function that will
> > return "sbcl" or "ecl" can be used. There's an example in the
> > sbcl-trivial-backtrace package.
>
>
>
> --
>
> … наш разум - превосходная объяснительная машина которая способна
> найти смысл почти в чем угодно, истолковать любой феномен, но
> совершенно не в состоянии принять мысль о непредсказуемости.



-- 

… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.

[-- Attachment #2: 0001-gnu-common-lisp-jupyter-Format-kernelspec.patch --]
[-- Type: text/x-patch, Size: 2392 bytes --]

From cbc17c767069e8fa5175f2f0f30fc961a2be319a Mon Sep 17 00:00:00 2001
From: Sharlatan Hellseher <sharlatanus@gmail.com>
Date: Mon, 24 May 2021 22:18:28 +0100
Subject: [PATCH] gnu: common-lisp-jupyter: Format kernelspec

---
 gnu/packages/lisp-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm
index 4a1e9064d5..91370c62c4 100644
--- a/gnu/packages/lisp-xyz.scm
+++ b/gnu/packages/lisp-xyz.scm
@@ -14897,6 +14897,41 @@ and @code{doseq*}.")
          (sha256
           (base32 "0si69xfzi769dprwfy7gp1x3bl7lxz6d4n98sa26w9r41wvay5ja"))))
       (build-system asdf-build-system/sbcl)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after 'create-asdf-configuration 'generate-kernelspec
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (kernelspec (string-append out "/share/cl-jupyter/kernelspec")))
+                 (mkdir-p kernelspec)
+                 (copy-file (string-append "res/" (%lisp-type) "/logo-64x64.png")
+                            (string-append kernelspec "/logo-64x64.png"))
+                 (with-output-to-file (string-append kernelspec "/kernel.json")
+                   (lambda ()
+                     ;; FIXME: Use of guile-json would beneficial here
+                     (format #t "{ \"argv\": [ ~s,
+ \"--eval\",
+\"(require :asdf)\",
+ \"--eval\",
+\"(asdf:load-system :common-lisp-jupyter)\",
+ \"--eval\",
+\"(jupyter:run-kernel 'common-lisp-jupyter:kernel)\",
+\"{connection_file}\"
+],
+\"display_name\": \"Common Lisp\",
+\"language\": \"common-lisp\",
+\"interrupt_mode\": \"message\"
+}"
+                             (string-append (assoc-ref %build-inputs (%lisp-type)) "/bin/" (%lisp-type))))))))
+      (add-after 'generate-kernelspec 'install-kernelspec
+        (lambda* (#:key outputs #:allow-other-keys)
+          (let* ((out (assoc-ref outputs "out"))
+                (kernelspec (string-append out "/share/cl-jupyter/kernelspec")))
+            (invoke "jupyter" "kernelspec" "install"
+                    "--name" "cl-jupyter"
+                    "--prefix" out
+                    kernelspec)))))))
       (inputs
        `(("alexandria" ,sbcl-alexandria)
          ("babel" ,sbcl-babel)
-- 
2.31.1


  reply	other threads:[~2021-05-24 21:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 19:44 bug#46333: sbcl-common-lisp-jupyter does not install kernel.json Jack Hill
2021-05-18 16:12 ` Jack Hill
2021-05-18 16:58   ` Guillaume Le Vaillant
2021-05-19 22:23     ` Sharlatan Hellseher
2021-05-24 21:28       ` Sharlatan Hellseher [this message]
2021-05-25 15:40         ` Guillaume Le Vaillant
2021-06-08 14:48 ` bug#46333: Install Command Line Tarn Burton
2021-06-14 15:21 ` bug#46333: Typos Tarn Burton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAO+9K5oz-Cwi_Jh7pkGUKZx3mQTbfxKsqcu0=h-7rMNAGsTtdQ@mail.gmail.com' \
    --to=sharlatanus@gmail.com \
    --cc=46333@debbugs.gnu.org \
    --cc=glv@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).