ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

voila doesn't display widgets with ipywidgets-8

Open ruomad opened this issue 3 years ago • 8 comments

When using ipwidgets-8 (tested with b1 and rc0), voila does not display the widgets, where it works flawlessly with ipywidgets-7 (7.6.5).

Minimal example cell :

import ipywidgets as widgets

w = widgets.Label(value = 'Test')

display(w)

environment :

  • python 3.10.2
  • voila 0.3.3

I use poetry but I uploaded minimal examples to my github repo :

  • https://github.com/ruomad/test-ipywidgets-7
  • https://github.com/ruomad/test-ipywidgets-8

I use poetry but the examples run on heroku (voila):

  • https://test-ipywidgets-7.herokuapp.com
  • https://test-ipywidgets-8.herokuapp.com

No error as far as I can tell in the logs. I'm attaching an extract of a diff between voila debug logs

diff.txt

ruomad avatar Mar 12 '22 12:03 ruomad

Thanks for opening an issue. This is an expected behavior, we'll need to update voila when ipywidgets 8 is released.

martinRenou avatar Mar 12 '22 16:03 martinRenou

Related https://github.com/voila-dashboards/voila/pull/1046

maartenbreddels avatar Mar 12 '22 19:03 maartenbreddels

To further document the issue, I see the same problem with ipywidgets 7.7.0, where it works with ipywidgets-7.6.5 (probably related to the backports in 7.7.0)

ruomad avatar Mar 17 '22 08:03 ruomad

Oh, I believe this might be related indeed, but we probably don't want Voila to break when ipywidgets 7.7 is out. I will test it out, thanks!

martinRenou avatar Mar 17 '22 08:03 martinRenou

OK I have a minimal example of what 7.7.0 breaks in my app. I use grid.

import ipywidgets as widgets

grid = widgets.GridspecLayout(2, 2)
w0 = widgets.Label('Test')
w1 = widgets.Dropdown(options = [100, 200], value = 100)

#grid = widgets.GridspecLayout(2, 2)
grid[0, 0] = w0
grid[0, 1] = w1
display(grid)

The above doesn't show up in voila (both standalone and as a jupyterlab extension). If I uncomment the second 'grid =...' line it works (ie displacing the grid initialization AFTER widgets definition). Hope this gives you a clue.

ruomad avatar Mar 17 '22 13:03 ruomad

From the console errors (Uncaught (in promise) Error: widget model not found), it seems that there is some problem with voila fetching the widget state. That was changed in 7.7 (and 8.0) with utility functions in the base widget manager, now available in the jlab widget manager.

jasongrout avatar Mar 17 '22 15:03 jasongrout

I faced with the same issue with 8.0.7 ipywidgets version. Could you tell me what solution is here?

MaryRa avatar Jul 05 '23 10:07 MaryRa

Which Voila version are you using? Voila 0.4.x works with ipywidgets 8

martinRenou avatar Jul 05 '23 12:07 martinRenou