Can nbviewer render interactive widgets in a Jupyter notebook (using ipywidgets)?

104 Views Asked by At

I created an interactive widget in Jupyter lab using Ipywidgets interact() class. The widget allows you to select a column from a dataframe to visualise, it then displays a plotly plot of that column. The widget works as intended in Jupyter lab. When I push the notebook to github then view the notebook on nbviewer (see it here in cell 5) I cannot see the widget, instead all I see is the text below:

interactive(children=(Dropdown(description='col_selected', options=('time_period_desc_fixed', 'price_type', 's…

I wanted the widget to be visible and interactive on nbviewer i.e. wanted a user to be able to select different columns to visualise with a drop down.

I tried the following:

  • I ensured that 'Save widget state automatically' setting was switched on in Jupyter lab and saved the file with the working widget before pushing to github.
  • I tried converting the notebook to html with both nbconvert from command line and with the Jupyter lab export as html option. The html file had the interactive drop down available but it did not show the plots, but rather it showed unrendered html code, presumably of the plots.
  • I tried using Jupyter Notebook and the 'Save Widget State' option then pushing to git.
jupyterlab 3.6.3
ipywidgets 8.0.6
0

There are 0 best solutions below