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

On Wednesday, February 2, 2022 at 6:59:24 PM UTC-6 Matthias Koeppe wrote:

> On my machine, macOS with Sage 9.5 compiled from source, I see the 404s 
> too, but the widget from the notebook work anyway. 
>
>
> On Wednesday, February 2, 2022 at 10:03:16 AM UTC-8 Marc Culler wrote:
>
>> 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
>>
>> On Wednesday, February 2, 2022 at 10:03:18 AM UTC-6 Marc Culler wrote:
>>
>>> 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.
>>> On Wednesday, February 2, 2022 at 9:36:10 AM UTC-6 Marc Culler wrote:
>>>
>>>> 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
>>>>
>>>> On Tuesday, February 1, 2022 at 9:21:23 PM UTC-6 Marc Culler wrote:
>>>>
>>>>> 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
>>>>>
>>>>> On Tue, Feb 1, 2022 at 6:14 PM Matthias Koeppe <matthia...@gmail.com> 
>>>>> wrote:
>>>>>
>>>>>> Marc, are you referring to these instructions?
>>>>>>
>>>>>> https://doc.sagemath.org/html/en/installation/launching.html#setting-up-sagemath-as-a-jupyter-kernel-in-an-existing-jupyter-notebook-or-jupyterlab-installation
>>>>>>
>>>>>>
>>>>>> On Tuesday, February 1, 2022 at 3:28:48 PM UTC-8 Marc Culler wrote:
>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>> On Tuesday, February 1, 2022 at 1:26:33 PM UTC-6 slelievre wrote:
>>>>>>>
>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>> https://github.com/Wuliyuanulb/ComponentSDKDoc/blob/bfe53cf2162f62134356b58d7eae07e367044602/_build/_sources/faq.md.txt
>>>>>>>>
>>>>>>>> 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.
>>>>>>>>
>>>>>>>> https://github.com/Caltech-IPAC/firefly_widgets/issues/6
>>>>>>>> https://github.com/InsightSoftwareConsortium/itkwidgets/issues/207
>>>>>>>>
>>>>>>>> https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/1319
>>>>>>>> https://github.com/jupyter-widgets/ipywidgets/issues/2569
>>>>>>>> https://github.com/jupyter-widgets/ipywidgets/issues/377
>>>>>>>> https://github.com/jupyterlab/jupyterlab/issues/4398
>>>>>>>> https://github.com/maartenbreddels/ipyvolume/issues/36
>>>>>>>> https://github.com/OpenGeoscience/geonotebook/pull/51
>>>>>>>> https://github.com/twosigma/beakerx/issues/6582
>>>>>>>>
>>>>>>>> Found by searching using this request
>>>>>>>>
>>>>>>>>
>>>>>>>> https://github.com/search?q=Class+jupyter.widget+not+found+in+registry&type=issues
>>>>>>>>
>>>>>>>> Not sure that helps at all, sorry.  --Samuel
>>>>>>>>
>>>>>>>> -- 
>>>>>> 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
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/sage-support/26b228ed-ed16-400b-849c-7c3be030a413n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/1d56584d-915f-46e7-965a-5fbbe5acd490n%40googlegroups.com.

Reply via email to