robert-dodier / maxima-jupyter

A Maxima kernel for Jupyter, based on CL-Jupyter (Common Lisp kernel)
Other
185 stars 31 forks source link

Unable to install maxima-jupyter #84

Closed AuroransSolis closed 3 years ago

AuroransSolis commented 3 years ago

I've been giving installing this a go for a while now to no avail. I'm sure I'm missing something or doing something stupid, so I'm putting this here in the hopes that someone can help me spot the issue I'm clearly blind to.

As of time of writing, I've tried all of the listed installation methods excluding the Docker ones, since I'm not too chuffed about the work it would take to get that enabled just for a single application. Here's the issues with each of the methods of installation:

Current installation method (from source) First, I installed Quicklisp (`curl`-ed quicklisp.lisp and used that to install, then made sure everything was up to date with `(ql:update-dist "quicklisp")` and `(ql:update-client)`), and then I cloned this repository to `~/quicklisp/local-projects`. I'm not sure if this is the right place, though suggestions from some people I asked (and a few blog posts on the internet) gave me the idea that it might be. After doing that, I ran `maxima` and tried both `load("load-maxima-jupyter.lisp);` and `:lisp (load "load-maxima-jupyter.lisp)`. Neither worked, with the following error: ``` While evaluating the form starting at line 14, column 0 of Maxima encountered a Lisp error: Component :MAXIMA-JUPYTER not found Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. ``` My next thought was to try doing what the pkgbuild in the AUR does. This was done manually since, well, I'm not using Arch or an Arch-based distro. In order to do this I made a modified load.lisp: ```lisp (load "~/quicklisp/setup.lisp") (load "load-maxima-jupyter.lisp") ``` and ran `maxima --preload-lisp=load.lisp --batch-string="jupyter_system_install(false,\"./mj");"`, which produced
long error message ``` While evaluating the form starting at line 129, column 0 of #P"~/quicklisp/setup.lisp": While evaluating the form starting at line 1, column 0 of Maxima encountered a Lisp error: Can't create directory /var/tmp/portage/sci-mathematics/maxima-5.44.0/ Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. #P"/home/auro/quicklisp/local-projects/maxima-jupyter/load.lisp": While evaluating the form starting at line 129, column 0 of #P"~/quicklisp/setup.lisp": While evaluating the form starting at line 1, column 0 of #P"/home/auro/quicklisp/local-projects/maxima-jupyter/load.lisp": debugger invoked on a SB-INT:SIMPLE-CONTROL-ERROR in thread #: attempt to THROW to a tag that does not exist: MAXIMA::RETURN-FROM-DEBUGGER Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [RETRY ] Retry directory creation. 1: [RETRY ] Retry compiling #. 2: [ACCEPT ] Continue, treating compiling # as having been successful. 3: Retry ASDF operation. 4: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration. 5: Retry EVAL of current toplevel form. 6: [CONTINUE ] Ignore error and continue loading file "/home/auro/quicklisp/setup.lisp". 7: [ABORT ] Abort loading file "/home/auro/quicklisp/setup.lisp". 8: Retry EVAL of current toplevel form. 9: Ignore error and continue loading file "/home/auro/quicklisp/local-projects/maxima-jupyter/load.lisp". 10: Abort loading file "/home/auro/quicklisp/local-projects/maxima-jupyter/load.lisp". 11: Ignore runtime option --eval "(cl-user::run)". 12: Skip rest of --eval and --load options. 13: Skip to toplevel READ/EVAL/PRINT loop. 14: [EXIT ] Exit SBCL (calling #'EXIT, killing the process). (THROW) 0] ```
Not sure what's up with that, if I'm honest. I should also mention that both of the above were done with ```lisp ;;; The following lines added by ql:add-to-init-file: #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) ``` in `~/.sbclrc`, and additional attempts at installing were also made with a duplicate of that in `~/.maxima/maxima-init.lisp`, which produced the following error:
shorter error message this time but I still feel like I should spoiler it ``` Maxima 5.44.0 http://maxima.sourceforge.net using Lisp SBCL 2.0.4 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. While evaluating the form starting at line 129, column 0 of #P"/home/auro/quicklisp/setup.lisp": While evaluating the form starting at line 2, column 0 of #P"/home/auro/.maxima/maxima-init.lisp": ; ; compilation unit aborted ; caught 3 fatal ERROR conditions loadfile: failed to load /home/auro/.maxima/maxima-init.lisp -- an error. To debug this try: debugmode(true); Maxima encountered a Lisp error: attempt to THROW to a tag that does not exist: MACSYMA-QUIT Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. debugger invoked on a SB-INT:SIMPLE-CONTROL-ERROR in thread #: attempt to THROW to a tag that does not exist: RETURN-FROM-DEBUGGER Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [MACSYMA-QUIT] Maxima top-level 1: [CONTINUE ] Ignore runtime option --eval "(cl-user::run)". 2: [ABORT ] Skip rest of --eval and --load options. 3: Skip to toplevel READ/EVAL/PRINT loop. 4: [EXIT ] Exit SBCL (calling #'EXIT, killing the process). (THROW) 0] ```
Old method 1 After making the binary directory, running `:lisp (sb-ext:save-lisp-and-die #P"binary/binary-sbcl/maxima-jupyter-exec" :executable t :toplevel 'maxima-jupyter:kernel-start-exec)` in Maxima fails with ``` Maxima encountered a Lisp error: Package MAXIMA-JUPYTER does not exist. Line: 1, Column: 132, File-Position: 132 Stream: # ```
Old method 2 I was able to run `python ./install-maxima-jupyter.py --user --root=$(pwd)` just fine, but when it came to running Maxima in Jupyter, Jupyter would be outputting a message similar to the above: `Package MAXIMA-JUPYTER does not exist`. I don't particularly feel like doing this install again, but I of course forgot to get a copy of the error message in text. So, instead, here's a screenshot of it that I sent to a friend while whinging about not being able to get this working earlier this evening:
Image ![image](https://user-images.githubusercontent.com/25749440/96860842-20620f00-1418-11eb-9da7-9e735eeb1384.png)

Any help would be much appreciated - I'm (somewhat) fond of Maxima, and would like to keep using it instead of having to learn another language to use with Jupyter Notebooks.

robert-dodier commented 3 years ago

It sounds like you have the pieces in place. Here's what I'm doing, this works for me, I hope it can work for you too.

I have cloned the maxima-jupyter repo into $HOME/github (not under quicklisp/local-projects). I cd to $HOME/github/maxima-jupyter. I launch Maxima built with SBCL. Then :lisp (load "load-maxima-jupyter.lisp") and then jupyter_install_image();.

I have updated via git pull origin master (with origin = https://github.com/robert-dodier/maxima-jupyter.git) to get a recent bug fix (not related, from what I can see, to the "cannot find component :MAXIMA-JUPYTER" which you are seeing).

I think "cannot find component" is coming from ASDF and so, I guess, from Quicklisp. I see there is some machinery in load-maxima-jupyter.lisp about figuring out from where load-maxima-jupyter.lisp is being loaded (via LOAD-TRUENAME) and then telling ASDF to look there, so that maxima-jupyter.asd can be found. Maybe the error about "cannot find component" means that business about locating the .asd has not worked as expected.

Hope this helps! Keep me posted. I'm sorry for the bother. Thanks for your interest in Maxima and maxima-jupyter.

AuroransSolis commented 3 years ago

Thanks so much for all your help, but it turns out it was my fault. Kind of. As it turns out, when Portage builds Maxima it doesn't source any .sbclrc, and so Maxima was never built with Quicklisp. I built Maxima myself, and then it magically worked, maxima-jupyter and all. I checked all the example files provided in this repo and found nothing wrong. I wasn't able to use the new installation method with the manually built Maxima, but the old method using python3 ./install-maxima-jupyter.py --root=$(pwd) --user --maxima=/path/to/maxima/build worked a charm.