Interact broken. SageMath 9.5 on Apple Mac OSX 12.1 . SageMath-9.5_x86_64

229 views
Skip to first unread message

Alan Stafford

unread,
Jan 28, 2022, 1:02:57 PM1/28/22
to sage-support
Interact just calls the function but no Interact widgets appear.

Example attached. It works at Cocalc.
Interact.ipynb

kcrisman

unread,
Jan 29, 2022, 1:28:39 PM1/29/22
to sage-support
Just for data points, which browsers did you try on this?  Thanks for reporting.

Dima Pasechnik

unread,
Jan 29, 2022, 1:40:10 PM1/29/22
to sage-support
On Sat, Jan 29, 2022 at 6:28 PM kcrisman <kcri...@gmail.com> wrote:
>
> Just for data points, which browsers did you try on this? Thanks for reporting.

for what's worth, the interact works on Linux with Firefox.

>
> On Friday, January 28, 2022 at 1:02:57 PM UTC-5 alan_thoma...@yahoo.co.uk wrote:
>>
>> Interact just calls the function but no Interact widgets appear.
>>
>> Example attached. It works at Cocalc.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/e0a15937-dcd4-49aa-9dce-cda82b3e3fa0n%40googlegroups.com.

Alan Stafford

unread,
Jan 29, 2022, 3:05:48 PM1/29/22
to sage-support
I only used Safari. Safari supports widgets at Cocalc so I can't think that it won't support them should I run it locally. Interact has worked on previous versions of SageMath. I am hoping the Mac support team will look into this.

Dima Pasechnik

unread,
Jan 29, 2022, 3:09:36 PM1/29/22
to sage-support
On Sat, Jan 29, 2022 at 8:05 PM 'Alan Stafford' via sage-support
<sage-s...@googlegroups.com> wrote:
>
> I only used Safari. Safari supports widgets at Cocalc so I can't think that it won't support them should I run it locally. Interact has worked on previous versions of SageMath. I am hoping the Mac support team will look into this.

Cocalc has its own implementation for handling ipython notebooks. No
wonder that it might be totally different locally, with different code
handling notebook.

Can you try with Chrome?

>
> On Saturday, January 29, 2022 at 6:40:10 PM UTC dim...@gmail.com wrote:
>>
>> On Sat, Jan 29, 2022 at 6:28 PM kcrisman <kcri...@gmail.com> wrote:
>> >
>> > Just for data points, which browsers did you try on this? Thanks for reporting.
>>
>> for what's worth, the interact works on Linux with Firefox.
>>
>> >
>> > On Friday, January 28, 2022 at 1:02:57 PM UTC-5 alan_thoma...@yahoo.co.uk wrote:
>> >>
>> >> Interact just calls the function but no Interact widgets appear.
>> >>
>> >> Example attached. It works at Cocalc.
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "sage-support" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/e0a15937-dcd4-49aa-9dce-cda82b3e3fa0n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/8f13034e-c737-4e4a-bc58-ceb6d7177281n%40googlegroups.com.

Alan Stafford

unread,
Jan 29, 2022, 3:22:13 PM1/29/22
to sage-support
Exactly the same using Google Chrome.

Alan Stafford

unread,
Jan 30, 2022, 10:59:36 PM1/30/22
to sage-support
I have found that it doesn't work if I launch from the SageMath 9.5 icon for any kernel 9.4 or 9.5. If I launch from the SageMath 9.4 interface it works for either kernel.



Dima Pasechnik

unread,
Jan 31, 2022, 7:45:31 AM1/31/22
to sage-support
On Mon, Jan 31, 2022 at 3:59 AM 'Alan Stafford' via sage-support
<sage-s...@googlegroups.com> wrote:
>
> I have found that it doesn't work if I launch from the SageMath 9.5 icon for any kernel 9.4 or 9.5. If I launch from the SageMath 9.4 interface it works for either kernel.

I am not sure I follow here. How do you install Sage?

The basic thing that should work is starting Sage from terminal, as

sage -n

The macOS GUI we used to have is quite broken, and was removed, the
one we currently recommend is
https://github.com/3-manifolds/Sage_macOS/releases


>
>>>
>>>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/7b98180b-e489-411b-a046-a8f30269d3f2n%40googlegroups.com.

Alan Stafford

unread,
Jan 31, 2022, 10:09:42 AM1/31/22
to sage-support

I have downloaded both the SageMath 9.5 beta and 9.4 SageMath releases from git. I do not get widgets should I start the 9.4 or 9.5 kernel using the 9.5 interface, but I do when I use the 9.4 interface.

Marc Culler

unread,
Jan 31, 2022, 12:51:38 PM1/31/22
to sage-support
It sounds to me like you do not have the SageMath 9.5 Jupyter kernel installed in /usr/local.  That gets installed when you run the Installer package that is included on the disk image.  Did you perhaps forget to run that installer after dragging the app to /Applications?

- Marc

Alan Stafford

unread,
Feb 1, 2022, 6:32:23 AM2/1/22
to sage-support
I have run the Recommended_9_5.pkg file.

Marc Culler

unread,
Feb 1, 2022, 10:13:27 AM2/1/22
to sage-support
Thanks.  And I can reproduce this.  I see the error shown below in the Firefox Console.  (I include it
here in case anyone might recognize it).

- Marc

Could not open comm  --  Error: Class jupyter.widget not found in registry   utils.js:930
    load_class                                           utils.js:894
    load_class                                           utils.js:879
    comm_open                                        comm.js:84
    i                                                          jQuery
    _handle_iopub_message                    kernel.js:1238
    _finish_ws_message                           kernel.js:1017
    _msg_queue                                        kernel.js:1008
    promise callback*Kernel.prototype._handle_ws_message kernel.js:1008
    i                                        jQuery
    reject                                utils.js:930
    (Async: promise callback)
    comm_open                    comm.js:85
    i                                       jQuery
    _handle_iopub_message kernel.js:1238
    _finish_ws_message       kernel.js:1017
    _msg_queue                   kernel.js:1008
    (Async: promise callback)
    _handle_ws_message    kernel.js:1008
    i                                     jQuery

slelievre

unread,
Feb 1, 2022, 2:26:33 PM2/1/22
to sage-support
2022-02-01 15:13:27 UTC, Marc Culler:

>
> Thanks. And I can reproduce this. I see the error shown below
> in the Firefox Console. (I include it here in case anyone might
> recognize it).


There's an FAQ entry here


that reads

> In browser F12 window, there is `Couldn't process kernel message`
> error in Console log. WrappedError message will be like:
> ```
> Error: Class jupyter.widget not found in registry at http://xxx
> ```
> This is because ipywidgets not correctly enabled in jupyter extension
> when using pip to install. Reinstall using conda will solve this issue.
> See [more details here](https://ipywidgets.readthedocs.io/en/latest/user_install.html).
> ```

> conda install -c conda-forge ipywidgets
> ```

And here are some more related discussions,
hoping there's something relevant to dig from them.


Found by searching using this request


Not sure that helps at all, sorry.  --Samuel

Marc Culler

unread,
Feb 1, 2022, 2:40:52 PM2/1/22
to sage-support
At some level the problem is that the Tornado web application used by Jupyter is returning a 404 when the client tries
to load:


I have no clue how the Tornado web application tries to translate that URL into a path to a static file named extension.js.
But that file does exist.  The difference between 9.4 and 9.5 with respect to that file is that it moved from local/share to
venv/share.  So I would guess that there is some part of how Jupyter configures its Tornado web application which
was not correctly adjusted to compensate for that change.

- Marc

Marc Culler

unread,
Feb 1, 2022, 6:28:48 PM2/1/22
to sage-support
So is Sage following those instructions during its build process?  The docs do not say what those jupyter commands actually do.  They have separate instructions for enabling the widgets when using a virtualenv.  Of course Sage's venv is not a true virtualenv as created by venv, so it is hard to know whether the virtualenv instruction apply for Sage or not.  But given that the widgets worked before Sage switched to its virtualenv-like venv I would guess that they do apply.

It is unclear to me whether this is an issue with the packaging of the SageMath app for macOS or whether it is an issue with Sage's build process, which I follow when building Sage for the app.  It would be helpful to know the meaning of the sentence "Most of the time, installing ipywidgets automatically configures Jupyter Notebook to use widgets."
Specifically, what does it mean to "configure Jupyter Notebook to use widgets".

- Marc

Matthias Koeppe

unread,
Feb 1, 2022, 7:14:13 PM2/1/22
to sage-support

Matthias Koeppe

unread,
Feb 1, 2022, 7:16:21 PM2/1/22
to sage-support
On Tuesday, February 1, 2022 at 3:28:48 PM UTC-8 Marc Culler wrote:
Of course Sage's venv is not a true virtualenv as created by venv,

It is actually a true venv, unless no system python can be used and Sage builds its own copy of python3.


 

Marc Culler

unread,
Feb 1, 2022, 10:12:50 PM2/1/22
to sage-s...@googlegroups.com
Well, OK.  Maybe so.

But I've never seen a venv that resulted in a path like sage/local/var/lib/sage/venv-python3.9.9/var/lib/sage/.

- Marc


--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/FlLA_7tUb0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/68d11539-11ba-4eac-aa91-db9926590d42n%40googlegroups.com.

Marc Culler

unread,
Feb 1, 2022, 10:21:23 PM2/1/22
to sage-s...@googlegroups.com
No.  I was referring to https://ipywidgets.readthedocs.io/en/latest/user_install.html which was Samuel's [more details here] link.

Incidentally, following those instructions did result in a log message indicating that the widgets had been enabled in Jupyter.  But there was no change in the behavior.  Attempting to load extension.js still produced a 404.

- Marc

--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/FlLA_7tUb0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/26b228ed-ed16-400b-849c-7c3be030a413n%40googlegroups.com.

Marc Culler

unread,
Feb 2, 2022, 10:36:10 AM2/2/22
to sage-support
What I said above appears not to be correct.  It looks like enabling the widgets extension with the instructions in the user_install page did work.  I am now getting a widget with Sage 9.5.  More testing is needed, but it looks promising.

- Marc

Marc Culler

unread,
Feb 2, 2022, 11:03:18 AM2/2/22
to sage-support
Never mind.  I must have accidentally tested with 9.4.  Tornado is still returning a 404 when the notebook tries to load /nbextensions/widgets/notebook/js/extension.js.

Marc Culler

unread,
Feb 2, 2022, 1:03:16 PM2/2/22
to sage-support
I figured it out.

* The root directory for the Tornado web application is sage/venv/share/jupyter (determined by trial and error).
* The path component in the url that the jupyter client uses to load the widget extension is
    /nbextensions/widgets/notebook/js/extension.js
* There is no directory named sage/venv/share/jupyter/nbextensions/widgets in the sage 9.5 tree.  Instead
there is a directory named sage/venv/share/jupyter/nbextensions/jupyter-js-widgets.

My fix was to create the directory sage/venv/share/jupyter/nbextensions/widgets/notebook
and a symlink sage/venv/share/jupyter/nbextensions/widgets/notebook/js -> ../../jupyter-js-widgets

With that change I get working widgets.  Experiment indicates that the jupyter-js-widgets directory
must exist.  But the widgets directory must also exist.  Why does the client use a path that does not
exist?  I do not know.  How can it be changed to use the correct path?  I was not able to figure that
out.  I could not find the code which the client uses to constructs its urls.  Maybe it is somewhere
inside a gigantic minimized javascript file.  Who knows?  Files containing only one line are not easily
searched with tools like grep.  I guess that is why facebook and twitter like them so much.

- Marc

Matthias Koeppe

unread,
Feb 2, 2022, 7:59:24 PM2/2/22
to sage-support
On my machine, macOS with Sage 9.5 compiled from source, I see the 404s too, but the widget from the notebook work anyway. 

Marc Culler

unread,
Feb 2, 2022, 11:33:18 PM2/2/22
to sage-support
That sounds very mysterious.  How can it create widgets if it cannot load the javascript file that implements the widgets?  Maybe the client finds the javascript file in some other path such as usr/local/jupyter and uses that file instead.  Of course a self-contained app cannot rely on anything like that.

- Marc

Matthias Koeppe

unread,
Feb 3, 2022, 1:47:35 AM2/3/22
to sage-support

Marc Culler

unread,
Feb 3, 2022, 11:05:17 AM2/3/22
to sage-support
It certainly does.  But that ticket is from 2017. (???)

- Marc

slelievre

unread,
Feb 9, 2022, 5:01:01 AM2/9/22
to sage-support
Pull request to fix Sage interacts on the CoCalc side:

Alan Stafford

unread,
Feb 9, 2022, 6:37:45 AM2/9/22
to sage-support
Interact is broken for SageMath 9.5, it works in 9.4 so I don't understand the pull request.

Marc Culler

unread,
Feb 9, 2022, 9:55:00 AM2/9/22
to sage-s...@googlegroups.com
They look like two unrelated problems.  In SageMath 9.5 there is a path problem which prevents the widgets nbextension.js file from being located by the Tornado server in some situations.  (That is fixed in the current release of the macOS app by creating a symlink at the path that the Tornado server uses for the nbextension.js file.)  The PR is about a possible bug in some version of jquery-ui.  The PR just updates to newer versions of jupyter-widgets, jquery and jquery-ui.

- Marc

--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/FlLA_7tUb0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.

kcrisman

unread,
Mar 30, 2022, 2:38:56 PM3/30/22
to sage-support
Just to follow up, did this issue get resolved satisfactorily in the 9.6 release cycle?  The last emails leave this unclear.

Marc Culler

unread,
Mar 30, 2022, 2:48:15 PM3/30/22
to sage-s...@googlegroups.com
This issue is resolved in the current release of the SageMath 9.5 macOS app.

- Marc

On Wed, Mar 30, 2022 at 1:39 PM kcrisman <kcri...@gmail.com> wrote:
Just to follow up, did this issue get resolved satisfactorily in the 9.6 release cycle?  The last emails leave this unclear.

--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/FlLA_7tUb0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.

kcrisman

unread,
Mar 31, 2022, 1:49:45 PM3/31/22
to sage-support
On Wednesday, March 30, 2022 at 2:48:15 PM UTC-4 Marc Culler wrote:
This issue is resolved in the current release of the SageMath 9.5 macOS app.

- Marc

Awesome. 
Reply all
Reply to author
Forward
0 new messages