Ralf,
I will probably look at this later but at first glance I would say
this issue comes from jfricas. Personally I test the Jupyter notebook
via a terminal with 'jupyter notebook' and choose the FriCAS
kernel. And if I execute ')read bugs2008' I get no output in the
terminal whereas
with ')ju plotly' or )read bugs2009' the notebook process barfs:
bugs2008 and after bugs2009:
================================================
openServer result 0
FriCAS Computer Algebra System
Version: FriCAS 2023-06-17
Timestamp: mer. 19 juil. 2023 19:47:21 CEST
-----------------------------------------------------------------------------
Issue )copyright to view copyright notices.
Issue )summary for a summary of useful system commands.
Issue )quit to leave FriCAS and return to shell.
-----------------------------------------------------------------------------
Value = T
Value = WEBSPAD::FRICAS-ACCEPTOR
[W 19:22:26.349 NotebookApp] Replacing stale connection:
5cb49a39-9070-4c39-8b41-b1ee72c259af:c8c2372d614e4eb2992f0108bc70b3c3
[I 19:22:26.350 NotebookApp] Starting buffering for
5cb49a39-9070-4c39-8b41-b1ee72c259af:c8c2372d614e4eb2992f0108bc70b3c3
[I 19:22:26.352 NotebookApp] Restoring connection for
5cb49a39-9070-4c39-8b41-b1ee72c259af:c8c2372d614e4eb2992f0108bc70b3c3
[IPKernelApp] WARNING | Unknown message type: 'comm_open'
[IPKernelApp] WARNING | Unknown message type: 'comm_msg'
[W 19:22:26.931 NotebookApp] 404 GET
/static/components/codemirror/mode/spad/spad.js?v=20230723192115
(127.0.0.1) 7.290000ms
referer=http://localhost:8888/notebooks/Untitled.ipynb?kernel_name=jfricas
Several seconds later the terminal prints:
[I 19:24:05.255 NotebookApp] Saving file at /Untitled.ipynb
/home/greg/.local/lib/python3.11/site-packages/nbformat/__init__.py:129:
MissingIDFieldWarning: Code cell is missing an id field, this will
become a hard error in future nbformat versions. You may want to use
`normalize()` on your notebooks before validations (available since
nbformat 5.1.4). Previous versions of nbformat are fixing this issue
transparently, and will stop doing so in the future.
validate(nb)
/home/greg/.local/lib/python3.11/site-packages/notebook/services/contents/manager.py:353:
MissingIDFieldWarning: Code cell is missing an id field, this will
become a hard error in future nbformat versions. You may want to use
`normalize()` on your notebooks before validations (available since
nbformat 5.1.4). Previous versions of nbformat are fixing this issue
transparently, and will stop doing so in the future.
validate_nb(model['content'])
It's saving Untitled.ipynb
And now, in the same notebook session, ')read bugs2009':
[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "/home/greg/.local/lib/python3.11/site-packages/ipykernel/kernelbase.py",
line 409, in dispatch_shell
await result
File "/home/greg/.local/lib/python3.11/site-packages/ipykernel/kernelbase.py",
line 720, in execute_request
reply_content = self.do_execute(
^^^^^^^^^^^^^^^^
File "/home/greg/.local/lib/python3.11/site-packages/jfricas/fricaskernel.py",
line 212, in do_execute
r = self.server.put(block)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/greg/.local/lib/python3.11/site-packages/jfricas/fricaskernel.py",
line 77, in put
self.output = json.loads(data.rstrip('\\n'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
And no output in the notebook. It seems jfricas stops processing the
command because
of an error in its side. I can evaluate bugs2009.input until
completion in a terminal for information.
To also be investigated I think .
__
Greg
Le dim. 23 juil. 2023 à 17:50, Ralf Hemmecke <[email protected]> a écrit :
>
> > If you ')read' in a FriCAS notebook src/input/bugs2008.input all is right
> > Bad things happen with bugs2009.input.
>
> Hmmmm... right, but certainly, bugs2009.input was never intended to be
> read by jfricas.
>
> The [*] that appears in Jupyter does not necessarily mean that the
> process runs indefinitely. It just indicates that jupyter did not get a
> proper answer yet. This can either be because the FriCAS computation is
> still running or there happens some error in the computation and FriCAS
> stops and goes into the debugger and thus does not contact Jupyter to
> tell that something went wrong.
>
> The latter is the source of the problem with ")read bugs2009.input".
>
> In order to see the FriCAS side I do not start the fricaskernel.py in
> the default way, but rather edit it at the end.
>
> Search for where you have installed jfricas.
> You probably find it close to where jupyter is:
>
> type jupyter
> /home/hemmecke/HDD/hemmecke/software/virtualenv/jfricas/bin/jupyter
>
> In my case it is
>
> /home/hemmecke/HDD/hemmecke/software/virtualenv/jfricas/lib/python3.10/site-packages/jfricas
>
> In this directory edit fricaskernels.py and comment out
>
> ## pid = Popen(['fricas','-eval',prereq,'-eval',start])
>
> I usually use the last suggestion there:
>
> pid = Popen(['gnome-terminal', '--title=jfricas', '--'] +
> ['fricas','-nosman','-eval',prereq,'-eval',start])
>
> Make sure you have gnome-terminal installed. (I also tried other
> terminal applications, but only was successful with gnome-terminal.)
> Anyway, it starts the terminal and from there it starts fricas in
> -nosman mode. The terminal contains basically exactly the fricas session
> that you see inside FriCAS, only that usual output of FriCAS commands
> are caught by jfricas and not shown in the terminal. However, in case of
> an error (FriCAS jumps into the lisp debugger) you have a chance to look
> at the terminal and clean things up outside of jupyter. From within
> jfricas, I have no idea how to handle such fall-into-debugger errors.
>
> BTW, when I )read bugs.input and afterwards (even with the [*] in that
> cell) enter 1+1 into a new cell, I get some results back *and* also the
> result 2.
>
> Actually, I do not know how jfricas can contact the running fricas
> session (and run additional commands) when FriCAS is in the debugger.
>
> Anyway, if you have jupytext installed, you can open bugs2009.input as a
> jupyter notebook and then execute the commands step by step via SHIFT-ENTER.
>
> Ralf
>
> --
> You received this message because you are subscribed to the Google Groups
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/fricas-devel/b6a716bf-0d34-a696-2a36-90f4c9a2d9e1%40hemmecke.org.
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/CAHnU2dbTGmz_J4BE3RxgH3-v08GZ9b5gK0XZsCy8N%3D0C%2BvqjyQ%40mail.gmail.com.