nbconvert: Widgets not displaying properly in HTML
I am trying to get widget.output() to display a table so that I can use HBox and VBox on the widget. Currently this code actually does display 2 tables side by side in the notebook:
import pandas as pd
from IPython.display import display
from ipywidgets import HBox, VBox
import ipywidgets as widgets
f = widgets.Output()
with f:
display(pd.read_csv('Book1.csv'))
display(HBox([f,f]))
However, the problem arises when I try to nbconvert the notebook to html which gives me this
Anyone know what the issue here might be?
The command I am using to convert is: jupyter nbconvert --execute file.ipynb
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 27 (12 by maintainers)
hello, any updates here? I’ve experienced the same issue as well …
Ok I’ll need to dig into why that’s happening for altair outputs specifically, might take me a couple days to find time to dig into it though as my free time is pretty limited.
This is now solved in nbclient, which means nbconvert 6.0 alpha has the fix.
Sorry for the delay in getting to this.
So the root problem is that nbconvert never had the ability to parse
application/vnd.jupyter.widget-view+json
message types, whichOutput()
use for display purposes. Only the widget javascript appears to have that encoded anywhere.From reading the messages sent from the kernel it appears the widgets are using the
comm_id
content type to capture outputs associated with a widget output (and skipping rendering to the cell), then using a method -> update call setting the msg_id to an empty string to indicate capture is done.then
then
saving the wdiget outputs so that
will re-render said output.
I’ll have to look into what the
Output
widget is doing. It’s possibly it’s relying on there being a javascript engine, or is reusing display ids but I’ll need to spend a little time diagnosing to know for sure.I am also having this problem. NBConvert 6.5.3
Hello, any update ? I am using the same code as erickfis but to display 2 pandas df. Displays perfectly on the notebook but when converting I get 2 columns displaying the HTML code of the tables. using nbconvert 7.2.6
Hello, I have the same issue while using matplot lab. The widget displays in ipython notebook, but while rendering with nbconvert into html, i dont see them there.
It is displays in notebook.
While using
I dont see any graphs in html report. It has been quite a task to figure out what’s happening.
Yes, this issue was resolved in https://github.com/jupyter/nbclient/issues/24 and nbclient >= 0.4.0 has the fix. NBconvert 6.0 (which should be releasing tomorrow) defaults to using nbclient and the issue overall should disappear. You can try it out on the 6.0.0rc0 release today if you like.