-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javascript error when rendering with version 2.4.1 #389
Comments
Interestingly, it works with |
I get the same kind of failure with the parametric geometry example, even in 2.4.0, except mine is:
|
I assume it is the same issue, you don't need any code to reproduce, just starting a new notebook. The browser console shows:
|
This problem will definitely occur in both ubuntu and windows. Using Jupyter notebook will cause this problem, but not Jupyter lab.
I'm not sure if Pythreejs supports Jupyter notebook, but I've tried many previous versions of Pythreejs and I've had issues similar to those associated with ‘RendererModel’. |
What output do you see from |
(if not see the |
or for lab: |
I don't know which of the commenters you are asking, but
There is jupyter-threejs (I would not get an error 'Failed to load extension: Array [ "nbextensions/jupyter-threejs/extension" ]' otherwise). |
I am experiencing the same issue on Windows 11 and Ubuntu 22.04. Just tested with:
Notebooks extension list (
Jupyterlab extension list (
Note that the very first error showing in the Chrome dev console, as soon as the notebook is loaded and before any cell gets executed, is:
This was pointed out in #395 and could be the root cause of this problem? |
Note, if you have the error |
This public path thing should be fixed in 2.4.2 that I just pushed to PyPI. Please try it and see if it resolves this issue as well. |
Wonderful, thank you! Just tested and |
Hmm, I don't seem to be able to reproduce my error anymore. I also tested Thanks for the support! |
I'm seeing similar javascript errors across several projects that depend on pythreejs. I was trying to generate a pythreejs visualization with PyDy in both jupyter notebook and then jupyter lab and I get this error in both Firefox and Chromium: This is with (conda forge packages):
I tried downgrading pythreejs and ipywidgets but still get the same error. You can also see that all visualizations in the PyDy documentation are now broken: https://pydy.readthedocs.io/en/stable/examples/carvallo-whipple.html (very bottom should show a pythreejs window). This example was built months ago and no longer displays, so this must be some change in a javascript library that is causing the issues. I haven't updated that page since it was working. The only thing that can change, I suppose, is that when you navigate to that page a javascript lib is downloaded that isn't pinned to a version that worked when it was built. I can even go back to a version of that page that was built like a year ago and it no longer works: https://pydy.readthedocs.io/en/v0.7.1/examples/carvallo-whipple.html My online book (and the pydy docs) generate pages using jupyter-sphinx and you can see a pythreejs example failing to load there too: https://moorepants.github.io/learn-multibody-dynamics/visualization.html This was build with pythreejs 2.3.0 which I pin in the CI builds. Seen here: https://moorepants.github.io/learn-multibody-dynamics/install.html#software-versions I've been unable to get pythreejs to display at all with any old versions (or the latest) in notebook or lab. Related issues: moorepants/learn-multibody-dynamics#149 Edit: I believe these errors have only appeared in the last week. I've been actively developing the book this past week and the animation was working within the last week on the Learn Multibody Dynamics web page. |
Can you test if this also occurs with PyPI packages? If PyPI works, there might be something wrong with the conda-forge recipe. |
I created a conda environment with: name: bicycle-kickplate-model
channels:
- conda-forge
dependencies:
- setuptools
- cython
- gmpy2
- ipython <8.9 # annoying change to history and tab completion
- jupyter
- matplotlib
- mpmath
- notebook
- numpy
- scipy
# deps for pythreejs
- jupyterlab
- nodejs
- ipydatawidgets
- ipywidgets
- traitlets I activated it and then installed pythreejs with
Relevant conda list lines:
I also want to point out again that the static web pages built even a year ago using a functioning set of conda forge packages for pythreejs no longer display the output. I haven't changed this page at all, for example: https://pydy.readthedocs.io/en/v0.7.1/examples/carvallo-whipple.html Yet, the display stopped working. The js console on that page displays:
|
I'm seeing this in the console on that page too:
|
I setup a more bare conda env with numpy, scipy, and sympy and then pip installed ipython, jupyter, pythreejs, notebook so that all jupyter related dependencies are pulled directly from PyPi. The same Javascript errors are present when running in Jupyter Notebook. I tried this notebook: Interestingly the two meshes display but the Renderer throws the errors. |
In the Jupyter Notebook the JS console gives this error (pythreejs==2.4.0, ipywidgets==8.0.1 pip installed):
|
I pip installed the combo of dependency versions from #395 (comment), i.e. |
I noticed that our example in the thebe docs no longer works (it was also built some time ago): https://thebe.readthedocs.io/en/stable/examples/pythreejs-example.html |
In the pythreejs docs (https://pythreejs.readthedocs.io/en/latest/examples/Animation.html) the renderer loads and the animations work. The console shows:
Edit: It seems to be loading the node package jupyter-threejs 2.1.0 which is some versions behind. |
Are these enough clues to help me look further? I'm not that familiar with how the JS parts of this package might work, but I have an interested in getting all the websites I've mentioned working again. |
In #389 they link to NVlabs/sionna#106 which shows that a specific combinations of packages is needed to get 2.4.2 to work. |
It looks like the problem is back after upgrading This set of version is working:
But upgrading
And in the console:
This commit or this commit might be relevant, although I really don't know the details. |
@bollwyvl might you have some insight on this issue? pythreejs is broken for me across all my websites and does not work in jupyter without very specific dependency pins. |
My tests agree with MerlinND #389 (comment). For me, pythreejs works with jupyterlab-widgets=3.0.5 constrains me to use jupyterlab<=3.6.3. This is unfortunate, because I really like the collapsible-section functionality that is built right into jupyterlab=4.0.1 by default. |
From the details reported by @merlinND #389 (comment), if the error started in jupyterlab-widgets 3.0.6, my bet is that this is a consequence of jupyter-widgets/ipywidgets#3689. And it seems related to jupyter-widgets/ipywidgets#3735. |
I also noticed the same issue and pinned |
I noticed today that the pythreejs visualizations on my website now work again, even though I have not updated anything on my side, for example: |
There was a ipwidgets release 2 days ago https://github.com/jupyter-widgets/ipywidgets/releases/tag/8.1.1 8.1.1 that reverts some PRs, but no idea if that is what fixed things. |
This comment jupyter-widgets/ipywidgets#3735 (comment) says that the deserializer in the reverted PRs broke PyThreeJs jupyter-widgets/ipywidgets#3735 (comment) |
I also have a general question about this. It seems that our static websites (generated from jupyter notebooks + ipywidgets + pythreejs) can break if ipwidgets makes releases. The only reason I can think this occurs is if the static HTML has calls to download javascript from a CDN that is not pinned to a specific version. I would hope that if I post a static website, it wouldn't break if newer versions of the javascript packages are uploaded to npm, for example. Is this what is happening and, if so, shouldn't the javascript be pinned in the static HTML output? |
Yes, this problem is also present in Voila (or was before 0.5). I don't think we should do semver matching, or more strict semver matching (~ instead of ^). See also widgetti/ipyvue#78 (comment) |
Want to say that I am also facing the same problem as @moorepants , with the render call returning the javascript error saying it could not instantiate the class. I updated to the latest ipywidgets (8.1.1) and now things are working on jupyter-nbclassic. It doesn't work however on the new notebook (7), even though I seem to have the extension enabled. |
When trying to render anything in a new conda env with version
2.4.1
, I get this Javascript error iconCode to reproduce:
The more detailed error after clicking:
Versions:
The text was updated successfully, but these errors were encountered: