-
Notifications
You must be signed in to change notification settings - Fork 949
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
widget not rendering on nbviewer or HTML #1692
Comments
It looks like the widget javascript is being loaded twice from unpkg.com in the notebook that does not render on Nbviewer, see below: Nbviewer seems to be loading an old version (1.0.0) of the widget along with the latest version (1.13.1). Maybe this is causing the problem. The old notebook that renders correctly on Nbviewer only loads one version of clustergrammer_widget (version 1.13.1), see below |
I took a quick look, and I see in the source a |
Thanks. I tried setting I can now see |
@jasongrout or @SylvainCorlay : i guess nbviewer needs an update for this to work I guess, since it still includes the version 6 jupyter-js-widgets javascript file. @cornhundred does the html work? |
@jasongrout the html does not work either link to html file on testing branch |
Try |
@maartenbreddels the I'm also noticing that |
@maartenbreddels @jasongrout @SylvainCorlay I checked that reverting to ipywidgets version 6.0.0 saves the widgets in the notebook correctly nbviewer link. I'm guessing that my widget has something wrong with how it is saving its version in the notebook and this is only causing a problem in the new ipywidgets version 7.0.0. |
Are you correctly setting the |
Do you have your code posted somewhere? We could check it for the module version number. |
Yeah the widget code is here (this is a link to the testing branch where I am trying to fix this issue) I tried setting the and I can see the updated |
nbviewer won't work I think, since it includes the js file for ipywidget6, but copy pasting html HTML from the 'Embed Widgets' should work. |
The issue is in line 1 of the js file, you should use @jupyter-widget/base instead of jupyter-js-widgets, can you try that? |
See http://ipywidgets.readthedocs.io/en/latest/migration_guides.html for documentation of this. |
thanks @maartenbreddels I'm reading over the documentation |
Lets us know if you managed to fix it. |
@maartenbreddels I followed the migration guidelines (e.g. updated package.json) and I'm still not able to view the downloaded html. I'll have to double check the migration steps. Here is a notebook and html file if you would like to have a look. Rendering locally still works after the migration changes. |
What do you mean by locally? The only think that I know that should work is copying and pasting the html from 'Embed Widget', or using ipwidgets.embed, Let us first establish if this works.. Nbviewer and nbconvert I don't know (I would be surprised if they would actually). |
Okay, by locally I meant that the widget renders within a running Jupyter notebook. I tried copying and pasting the HTML from the It is also weird that it has more properties in the state object than it needs. I'm only making one widget, but I see data for seven (e.g. I see seven |
Ok, thanks. I'll let you know how I debugged this. In chrome, in the developer tools (View->Developer) go to the network tab (if you see nothing, refresh it). You should see a request to |
Thanks for debugging I see the request, but do you mean put |
I'm guessing that ipywidgets will support versioning of front-end JS from npm. Currently, any updates I make to the published npm package are pushed to all old notebooks. I think this is because I was not passing versioning info along correctly. |
No, as the migration docs say, change require('jupyter-js-widgets') to
require('@jupyter-widgets/base'). Run webpack or setup.py, copy
js/dist/index.js to the same dir as the html file, but rename it to
clustergrammer_widget.js
.
Do a grep for jupyter-js-widgets to make sure it is removed everywhere,
hope this works!
(from mobile phone)
Op 1 sep. 2017 23:41 schreef "Nicolas Fernandez" <[email protected]>:
Thanks for debugging, but do you mean put@jupyter-widgets/base in the same
directory (and if so where can I find that JS, on unpkg.com)? I'm reluctant
to publish to npm for fear of breaking old notebooks that are being
rendered on nbviewer.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1692 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABryPQIvVh-_DnuUq0vD3PqKXBh6oUrBks5seHoHgaJpZM4PKYC8>
.
|
Thanks that worked :) I had to add JQuery (from CDN) since my script required it, but now the widget loads from the copy-and-paste embed HTML. I'll hold off on using ipywidgets 7.0.0 until NBviewer support is working. |
Thanks for sharing that it works. And I agree, we should get nbviewer working. |
Thanks, also @maartenbreddels really cool talk at JupyterCon about visualizing a billion stars. |
👍 thanks, glad you liked it. |
I've opened jupyter/nbviewer#717 in nbviewer where the fix needs to be made. I'm closing this in deference to that issue (please subscribe there to be notified when it is fixed). |
That does leave the generated html from I guess nbconvert right? I guess that does something similar. |
The nbconvert issue I should have linked as well is jupyter/nbconvert#636 |
I had to downgrade to ipywidget 6.0.0 from 7.0.3 to get it to work. pip install ipywidgets==6.0.0 I believe it is also mentioned here:
|
Hi
My widget (repo for clustergrammer_widget) is not rendering on nbviewer or when I save to HTML (it is rendering locally on jupyter notebook) and see the following errors in the developer console:
link to notebook on nbviewer where widget does not load
I believe this started happened when I upgraded (using pip) ipywidgets. Old notebooks are still loading in nbviewer link to notebook on nbviewer where the widget loads.
I'm using ipywidgets version 7.0.0 and widgetsnbextension 3.0.2. I noticed that the widgets menu has also changed to include Save and Clear Notebook Widget State options.
Best,
Nick
The text was updated successfully, but these errors were encountered: