Plots example (Plots.ipyenb) fails on mybinder
aokomoriuta opened this issue ยท 9 comments
https://mybinder.org/v2/gh/robert-dodier/maxima-jupyter/master doesn't show the result plots.
Restarting the kernel says FILE-DOES-NOT-EXIST: The file #P"/tmp/maxplot.svg" does not exist: No such file or directory
.
The problem seems about write-permission on /tmp
? But set_plot_option([svg_file, "./maxplot.svg"]);
causes same error.
How can I fix it?
Thanks for your message. What does build_info();
report?
Try changing contour_plot
in the notebook to the suggested plot2d([contour, ...], ...)
and evaluate that. Does that succeed?
build_info();
says:
build_info( 5.45.1 , 2021-12-11 13:09:55 , x86\_64-unknown-linux-gnu , SBCL , 2.1.11 , /home/jovyan/.maxima , /tmp , /home/jovyan/.maxima/binary/5\_45\_1/sbcl/2\_1\_11 ,๐๐๐ฅ๐ฌ๐,๐๐๐ฅ๐ฌ๐)
The error occurs for all plots but not only contour_plot. For example:
plot2d (sin(x), [x, -%pi, %pi])$
FILE-DOES-NOT-EXIST: The file #P"/tmp/maxplot.svg" does not exist: No such file or directory
3: ((FLET "H1" :IN JUPYTER:EVALUATE-CODE) The file #P"/tmp/maxplot.svg" does not exist: No such file or directory)
4: (SB-KERNEL::%SIGNAL The file #P"/tmp/maxplot.svg" does not exist: No such file or directory)
5: (ERROR FILE-DOES-NOT-EXIST PATHNAME /tmp/maxplot.svg MESSAGE No such file or directory)
6: (SB-IMPL::FILE-PERROR /tmp/maxplot.svg 2 FILE-DOES-NOT-EXIST)
7: (SB-IMPL::%OPEN-ERROR /tmp/maxplot.svg 2 IGNORE-THIS-ARG ERROR)
8: (OPEN /tmp/maxplot.svg DIRECTION INPUT ELEMENT-TYPE BASE-CHAR IF-EXISTS NIL IF-DOES-NOT-EXIST NIL EXTERNAL-FORMAT DEFAULT CLASS FD-STREAM)
9: (ALEXANDRIA:READ-FILE-INTO-STRING /tmp/maxplot.svg BUFFER-SIZE 4096 EXTERNAL-FORMAT NIL)
10: (JUPYTER::MAKE-FILE-MIME-BUNDLE /tmp/maxplot.svg NIL NIL T NIL NIL)
11: ((LAMBDA (ORIG &REST ARGS) :IN "/home/jovyan/.local/share/maxima-jupyter/local-projects/maxima-jupyter/src/overrides.lisp") #<FUNCTION $PLOT2D {5320B3EB}> ((%SIN SIMP (0 CELL:1543423015.MAC.NEWEST SRC)) $X) ((MLIST SIMP (0 CELL:1543423015.MAC.NEWEST SRC)) $X ((MTIMES SIMP) -1 $%PI) $%PI))
12: (MEVAL1 #<unavailable argument>)
13: (MEVAL (($PLOT2D (0 CELL:1543423015.MAC.NEWEST SRC)) ((%SIN (0 CELL:1543423015.MAC.NEWEST SRC)) $X) ((MLIST (0 CELL:1543423015.MAC.NEWEST SRC)) $X ((MMINUS (0 CELL:1543423015.MAC.NEWEST SRC)) $%PI) $%PI)))
14: (MEVALARGS (NIL (($PLOT2D (0 CELL:1543423015.MAC.NEWEST SRC)) ((%SIN (0 CELL:1543423015.MAC.NEWEST SRC)) $X) ((MLIST (0 CELL:1543423015.MAC.NEWEST SRC)) $X ((MMINUS (0 CELL:1543423015.MAC.NEWEST SRC)) $%PI) $%PI))))
15: (MEVAL1 ((NODISPLAYINPUT (0 CELL:1543423015.MAC.NEWEST SRC)) NIL (($PLOT2D (0 CELL:1543423015.MAC.NEWEST SRC)) ((%SIN (0 CELL:1543423015.MAC.NEWEST SRC)) $X) ((MLIST (0 CELL:1543423015.MAC.NEWEST SRC)) $X ((MMINUS (0 CELL:1543423015.MAC.NEWEST SRC)) $%PI) $%PI))))
16: (MEVAL ((NODISPLAYINPUT (0 CELL:1543423015.MAC.NEWEST SRC)) NIL (($PLOT2D (0 CELL:1543423015.MAC.NEWEST SRC)) ((%SIN (0 CELL:1543423015.MAC.NEWEST SRC)) $X) ((MLIST (0 CELL:1543423015.MAC.NEWEST SRC)) $X ((MMINUS (0 CELL:1543423015.MAC.NEWEST SRC)) $%PI) $%PI))))
17: (MEVAL* ((NODISPLAYINPUT (0 CELL:1543423015.MAC.NEWEST SRC)) NIL (($PLOT2D (0 CELL:1543423015.MAC.NEWEST SRC)) ((%SIN (0 CELL:1543423015.MAC.NEWEST SRC)) $X) ((MLIST (0 CELL:1543423015.MAC.NEWEST SRC)) $X ((MMINUS (0 CELL:1543423015.MAC.NEWEST SRC)) $%PI) $%PI))))
18: (MAXIMA-JUPYTER::MY-EVAL ((NODISPLAYINPUT (0 CELL:1543423015.MAC.NEWEST SRC)) NIL (($PLOT2D (0 CELL:1543423015.MAC.NEWEST SRC)) ((%SIN (0 CELL:1543423015.MAC.NEWEST SRC)) $X) ((MLIST (0 CELL:1543423015.MAC.NEWEST SRC)) $X ((MMINUS (0 CELL:1543423015.MAC.NEWEST SRC)) $%PI) $%PI))))
19: ((:METHOD JUPYTER:EVALUATE-FORM (MAXIMA-JUPYTER::KERNEL T T T)) #<KERNEL {1005C64D83}> #<FORM-TRACKING-STREAM for "file /tmp/8CE98EB3CD9342A2E7B467CE0CC44808-1543423015.mac" {100581F893}> CELL:1543423015.MAC.NEWEST NIL 1 0)
20: (JUPYTER/COMMON-LISP::REPL plot2d (sin(x), [x, -%pi, %pi])$ CELL:1543423015.MAC.NEWEST NIL)
21: ((:METHOD JUPYTER:EVALUATE-CODE (JUPYTER/COMMON-LISP:KERNEL T)) #<unused argument> plot2d (sin(x), [x, -%pi, %pi])$ CELL:1543423015.MAC.NEWEST NIL)
22: ((:METHOD JUPYTER:EVALUATE-CODE :AROUND (MAXIMA-JUPYTER::KERNEL T)) #<KERNEL {1005C64D83}> plot2d (sin(x), [x, -%pi, %pi])$ CELL:1543423015.MAC.NEWEST NIL)
23: (JUPYTER::HANDLE-EXECUTE-REQUEST)
24: (JUPYTER::RUN-SHELL #<KERNEL {1005C64D83}>)
25: ((LAMBDA NIL :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS))
26: ((FLET SB-UNIX::BODY :IN SB-THREAD::RUN))
27: ((FLET "WITHOUT-INTERRUPTS-BODY-10" :IN SB-THREAD::RUN))
28: ((FLET SB-UNIX::BODY :IN SB-THREAD::RUN))
29: ((FLET "WITHOUT-INTERRUPTS-BODY-3" :IN SB-THREAD::RUN))
30: (SB-THREAD::RUN)
31: ("foreign function: call_into_lisp")
32: ("foreign function: funcall1")
You can try and debug with https://mybinder.org/v2/gh/robert-dodier/maxima-jupyter/master (same as the link on the top of this issue)
BTW, I got the error only on the binder service. My maxima-jupyter on my local machine works well and shows the plot result.
Thanks for the additional information. It looks like the problem is the /tmp
directory since all plot functions are affected.
Is it possible that /tmp
doesn't exist in the Binder environment? I don't know how to resolve that. @yitzchak do you have any ideas what to do about that?
What is a folder which is certain to exist in Binder? Maybe plot2d
will succeed if you tell it to put outputs there.
I found the comment I wrote in the first is correct. It is not a problem about write-permission (file path to write), but about that Gnuplot is not installed on the binder.
After setting maxima_tempdir
,
maxima_tempdir:"/home/jovyan/maxima-jupyter/examples";
set_plot_option([svg_file, "maxplot.svg"]);
plot2d (sin(x), [x, -%pi, %pi])$
maxout49.gnuplot
is output on the current directory (maxima-jupyter/examples
), but the SVG file maxplot.svg
is not.
On the terminal launcher, I found
$ gnuplot
sh: gnuplot: command not found
Do you forget to install Gnuplot on the Dockerfile or somewhere the binder would need?
Additionally, I can confirm the correctness of the hypothesis if I can know how to check the output of gnuplot command from maxima.
I've pushed commit 588548 to modify Dockerfile to install gnuplot. Thanks for the reminder!
Now when I try to launch JupyterLab via mybinder.org, it successfully launches (installing gnuplot along the way as shown by the log messages), and I can start a Maxima notebook session, and some example operations (build_info
, makelist
, integrate
, etc) succeed. But when I try plot2d(sin(x), [x, 0, 10]);
it returns false
and displays nothing.
Not sure how to figure out what is going on there. I think the notebook can display out-of-band messages generated by Maxima, so the absence of error messages makes me think there aren't any.
I just tested with Plots.ipynb
and it seems to work in Binder.
Thanks for checking, Tarn. I find now that when I try the examples in Plots.ipynb that they work for me too; I think the key is to set the svg_file
option. I'm going to go ahead and close this ticket as fixed by commit 588548.
Thanks for fixing it. Now I can execute Plots.ipyenb
successfully with 588548e !