gkvoelkl / ipython-turtle-widget

Creating Turtle Geometry with IPython ipyturtle
MIT License
33 stars 12 forks source link

Demo fails with react error #36

Open cayhorstmann opened 1 year ago

cayhorstmann commented 1 year ago

After installing

pip install ipyturtle
jupyter nbextension enable --py ipyturtle

I load the demo into jupyter-notebook

from ipyturtle import Turtle
t = Turtle()
t

and get

[Open Browser Console for more detailed log - Double click to close this message]
Model class 'TurtleModel' from module 'ipyturtle' is loaded but can not be instantiated
TypeError: o._deserialize_state is not a function
    at u._make_model (http://localhost:8888/nbextensions/jupyter-js-widgets/extension.j

Here is the log in the browser console:

react-dom.production.min.js?v=dbc734e200d85090ca301fc67d29f674:1 Uncaught Invariant Violation: Minified React error #227; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=227 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at c (http://localhost:8888/static/components/react/react-dom.production.min.js?v=dbc734e200d85090ca301fc67d29f674:1:1614)
    at http://localhost:8888/static/components/react/react-dom.production.min.js?v=dbc734e200d85090ca301fc67d29f674:1:1683
    at Object.<anonymous> (http://localhost:8888/static/components/react/react-dom.production.min.js?v=dbc734e200d85090ca301fc67d29f674:1:96987)
    at n (http://localhost:8888/static/components/react/react-dom.production.min.js?v=dbc734e200d85090ca301fc67d29f674:1:123)
    at http://localhost:8888/static/components/react/react-dom.production.min.js?v=dbc734e200d85090ca301fc67d29f674:1:922
    at http://localhost:8888/static/components/react/react-dom.production.min.js?v=dbc734e200d85090ca301fc67d29f674:1:931
jquery.typeahead.min.js:3 --- jQuery Typeahead Debug ---
menubar.js:263 actions jupyter-notebook:find-and-replace does not exist, still binding it in case it will be defined later...
MenuBar.bind_events @ menubar.js:263
utils.js:60 load_extensions Arguments(3)
bidi.js:19 Loaded moment locale en
:8888/nbextensions/ipyturtle.js?v=20221127112528:1          Failed to load resource: the server responded with a status of 404 (Not Found)
Untitled1.ipynb:1 Refused to execute script from 'http://localhost:8888/nbextensions/ipyturtle.js?v=20221127112528' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
session.js:54 Session: kernel_created (131d516f-1064-459e-b24e-5466e33d1a1f)
kernel.js:462 Starting WebSockets: ws://localhost:8888/api/kernels/209b8c57-c9d4-4d83-9f4e-653a3b0728f0
utils.js:62 Failed to load extension: Array(1) Error: Script error for "nbextensions/ipyturtle"
https://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js?v=f0cc8bbb2fcef87fc194fecbb632fcfa:168:17)
    at HTMLScriptElement.onScriptError (require.js?v=f0cc8bbb2fcef87fc194fecbb632fcfa:1738:36)
(anonymous) @ utils.js:62
utils.js:37 Loading extension: ipyturtle/extension
kernel.js:106 Kernel: kernel_connected (209b8c57-c9d4-4d83-9f4e-653a3b0728f0)
utils.js:37 Loading extension: jupyter-js-widgets/extension
:8888/nbextensions/widgets/notebook/js/extension.js?v=20221127112528:1          Failed to load resource: the server responded with a status of 404 (Not Found)
Untitled1.ipynb:1 Refused to execute script from 'http://localhost:8888/nbextensions/widgets/notebook/js/extension.js?v=20221127112528' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
main.js:237 Widgets are not available.  Please install widgetsnbextension or ipywidgets 4.0
(anonymous) @ main.js:237
kernel.js:106 Kernel: kernel_ready (209b8c57-c9d4-4d83-9f4e-653a3b0728f0)
manager-base.js:434 TypeError: o._deserialize_state is not a function
    at u._make_model (manager-base.js:425:48)
_make_model @ manager-base.js:434
manager-base.js:434 TypeError: o._deserialize_state is not a function
    at u._make_model (manager-base.js:425:48)
_make_model @ manager-base.js:434
gkvoelkl commented 1 year ago

Turtle was never tested with react. In which environment do you work?

gkvoelkl commented 1 year ago

You can see https://github.com/Python-Ninja-Hebi/ipyturtle-next

cayhorstmann commented 1 year ago

I am running with Ubuntu 20.04 and the following in Help -> About:

The version of the notebook server is: 6.0.3
The server is running on this version of Python:

Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
[GCC 9.4.0]

Current Kernel Information:

Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

I don't do anything with React.

I tried https://github.com/Python-Ninja-Hebi/ipyturtle-next and got a different error:

TraitError: The '_canvas_manager' trait of a Canvas instance must be a _CanvasManager, but a value of class 'NoneType' (i.e. None) was specified.