-
Notifications
You must be signed in to change notification settings - Fork 429
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
How to retain widget state in output notebooks? #400
Comments
@choldgraf Have you clicked "Trust Notebook" after executing (bottom of https://nbconvert.readthedocs.io/en/latest/execute_api.html#widget-state highlights this)? |
Hmm - I think there might be multiple things going on there: You are correct that when I create a simple widget in a notebook, then use papermill to create a new notebook, then "trust" the notebook and reload the page, that the widget now shows up. However, this sometimes doesn't happen and I'm not sure why. For a more complex example, for this notebook: The method above doesn't work - if I "trust" the output notebook, I still get errors in rendering the widgets. Moreover when this is rendered on nbviewer (which I don't think should be affected by "trust notebook" or not) the widgets are just blank: So...I guess maybe this is some kind of interaction between ipywidgets, altair, and nbconvert? |
It does sound like an oddity with those libraries. Might be worth posting to altair and/or ipython issues. I will try to take a look this weekend at the example more closely for if there's something odd with nbconvert propagating the payload, but I suspect it's unlikely to be a problem there. |
that sounds good - I tried a bunch of combinations of plotting w/ altair and various tabbed widget outputs with ipywidgets, and couldn't get it to reproduce outside of the context of the mega notebook I linked above. If you don't think there's a path forward on this, feel free to close this one, as you say I doubt that this is a strictly papermill (or nbconvert) fix |
I have the same issue. The papermill changelog says that "ipywidgets are now supported" from version 1.0.0 but how would I trigger that from the command line? Is it possible to just add a parameter to |
I'm trying to use papermill to generate report notebooks that include ipywidgets in their outputs. When I use papermill to build these, the widget state doesn't seem to be included in the output notebook. I've tried playing around with this a bit and have found the following things:
jupyter-nbconvert --to notebook mynotebook.ipynb
) then the widgets display correctly--execute
to the nbconvert command, it also does not display correctly (jupyter-nbconvert --to notebook mynotebook.ipynb --execute
).So I guess this is a problem with executing the notebook rather than simply converting the output of a pre-existing notebook. The final point above makes me suspect that this is a problem at the
nbconvert
level rather than the papermill level, but I'd be curious if folks have run into this here and if there are any workarounds.It sounds like @maartenbreddels and @jasongrout worked on retaining widget state in jupyter/nbconvert#900 - perhaps they've got thoughts on achieving the same thing after executing the cells in a notebook
The text was updated successfully, but these errors were encountered: