Ipywidgets: widgetsnbextension issue in the docs?

Created on 9 Sep 2016  ·  25Comments  ·  Source: jupyter-widgets/ipywidgets

In the Layout and Styling page in the docs (and perhaps other places?), I don't see the outputs of the cells, only

Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"

Is this an

jupyter nbextension enable --py --sys-prefix widgetsnbextension

issue?

bug docs state

Most helpful comment

This is now fixed!

All 25 comments

This looks like an issue nbconvert which is used to convert the notebooks in this repo to static html. @willingc The ipywidgets layout and styling docs are displaying an error message where the output should be: https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Styling.html#Simple-examples

@SylvainCorlay @minrk I'm working on migrating back to the RTD docs theme and I'm seeing this when building the docs locally, too. Any idea why this notebook is returning "Widget Javascript not detected" and not the others?

@michaelpacer Looping you in as this appears to be an issue with nbconvert?

@gnestor thanks for getting the ball rolling on that. I will look into it this afternoon.

So I'm trying to reconstruct the doc build process (since actually…that seems to be undocumented).

If I convert directly to rst or html using nbconvert directly it has no output at all. The raw notebooks also have no output. This makes me think that its being executed first — but if so I'm not sure how this works as well as it does already. E.g., in the Widget Custom.ipynb it requires dateutil, but that is not included in the current environment.yml so it just errs.

I'm assuming somehow these errors are being silenced and the notebook is just converted without execution because once you add that a bunch of other cells are also outputting the same error.

What is the actual desired output? It's ambiguous.

If this were running in the browser, these outputs would be widgets.

But if I convert a fully executed notebook to html from inside a running notebook it simply doesn't include the output from widgets.

If I execute the notebook and save it with its outputs, and then convert it without adding the --execute flag, it also strips any widget outputs, but not outputs that are static text.

So if we want it to have no output, then we (only?) need to figure out why the execution flag in nbconvert the notebook acts differently from having run the notebook directly and then exporting to html.

If we want it to have some kind of output that is related to the widget itself (I think at some point @jdfreder and @willingc were working on this?), then that's a completely different problem.

@michaelpacer Did you do Widgets > Save Notebook with snapshots before exporting? If you try to export from the notebook without doing this, the widgets will not be included in the export.

screenshots

@SylvainCorlay Are we planning on rendering _live_ widgets in the docs or sticking with the static widgets?

I think that we will eventually have "live" widgets (i.e. javascript-based) widgets in the docs and nbviewer. Unlike the initial prototype of @jdfreder we are probably going to create a sphinx plugin instead of full-fledged theme.

PS: the backend-less widgets such as the ones on jupyter.org/widgets are what we called "static widgets" for some time. They are _static_ in that there is no python backend.

@SylvainCorlay Ok, thanks for clarifying. Have we considered just linking to live notebooks (on tmpnb or jupyterhub) from the docs? Features like interact can't be demoed without a kernel, so trying to export the _Using Interact.ipynb_ notebook to static HTML with static widgets doesn't make sense. Is there an issue or PR to track the "live widgets" effort or sphinx plugin?

@SylvainCorlay, @gnestor - reading through the above, I'm not sure what the concrete goal for this issue is. Can someone summarize what needs to be done for 6.0?

Based on my last convo with @SylvainCorlay, I think that he is going to work on sphinx extension for embedding interactive widgets in the docs. I don't know the details but I don't think that a 6.0 release needs to wait on this...

This issue is specifically regarding the outputs rendering Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension" in Layout and Styling docs. I am seeing outputs rendering Data type cannot be displayed: application/vnd.jupyter.widget in Widget List docs now. I suspect that the former has something to do with no saving widget snapshots with the notebook but it looks like the latter is a new bug.

I can confirm that the issue with Widget List docs is that the widget snapshots are not saved in the notebook, so outputs of application/vnd.jupyter.widget mime type cannot be rendered (by nbconvert when building the docs). Conversely, widget snapshots were saved in Widget Basics, so it has outputs with image/png mime type and it renders fine. I'm not sure why we're seeing this Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension" error in Widget Styling and not Widget List, but both don't have outputs with image/png mime type, so saving widget snapshots to these notebook files should resolve this issue, but I tried that and that brings up another issue of the notebook freezing on save widget snapshots: https://github.com/ipython/ipywidgets/issues/851

Assigning to Sylvain because it has to do with the sphinx extension.

To the extent that this relates to how we handle widgets in nbconvert: this PR https://github.com/jupyter/nbconvert/pull/482 and this issue https://github.com/jupyter/nbconvert/issues/481 may be relevant.

@SylvainCorlay What's the current status of the new sphinx extension? When it's ready to generate some docs, ping me here and I can help with that and close this issue out!

EDIT: I see some progress here: https://github.com/ipython/ipywidgets/pull/954

@gnestor most of it is ready.

The nbsphinx PR https://github.com/spatialaudio/nbsphinx/pull/76 should get merged soon which is the last missing piece to enable the rendering of widgets on RTD.

Nice! I will check out that PR and give it a try 👌

It seems to be working! Very nice work!

This is now fixed!

@SylvainCorlay @gnestor Beautiful!!! 🏖

There are still a bunch of interaction and display bugs on my phone, are
you targeting that use case, or no?

Note: they're already so good (I was already impressed) that I think it
would be a mistake to *not *target mobile browsers. I can imagine a really
neat demo showing this off by showing something in a presentation on your
screen and then telling people to go to the site on there phones and it
just works. That said, I've not done mobile targeting for extensive
JavaScript interactions, so I could imagine it's a black hole of effort. I
also realise that it's already a lot of effort to get them in the docs. So,
I wanted to check in before posting a bunch of separate bugs that will just
be closed because of project scope.

On Sun, Dec 11, 2016 at 08:14 Carol Willing notifications@github.com
wrote:

@SylvainCorlay https://github.com/SylvainCorlay @gnestor
https://github.com/gnestor Beautiful!!! 🏖


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ipython/ipywidgets/issues/761#issuecomment-266290736,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACXg6BJ2CqVRLc7q8-OUlDoIV81bVl0sks5rHCFcgaJpZM4J5N_r
.

Regarding the displaying on mobile devices, it is somewhat orthogonal to making them work in the docs or nbviewer / nbconvert, and will be specific to the implementation of each widget view.

pythreejs works well on mobile devices. The trick for core widgets is to make more use of native browser things which are implemented in an ad hoc way for each platform.

@SylvainCorlay Great work!!

@michaelpacer Please create an issue identifying these bugs and I will look into it 👍

Was this page helpful?
0 / 5 - 0 ratings