Bokeh 2.4- issue rendering ipywidgets

Trying to run the ipyleaflet_tiles.py I got the following error:

  File "/home/epinux/.local/lib/python3.9/site-packages/ipywidgets_bokeh/kernel.py", line 67, in send
    self._trigger_change(event)
  File "/home/epinux/.local/lib/python3.9/site-packages/ipywidgets_bokeh/kernel.py", line 83, in _trigger_change
    self.document._trigger_on_change(event)
AttributeError: 'Document' object has no attribute '_trigger_on_change'

full log: bokeh_serve_ipywidgets.log · GitHub

The same code works running bokeh 2.3.2, I tried to upgrade [ipywidgets, ipywidgets_bokeh] to the latest releases, but the error persists.

Thanks for any help!

1 Like

@epifanio This likely indicates that the ipywidgets extension package will need some update to be compatible with Bokeh >= 2.4. Please open a GitHub Issue.

1 Like

I’ve finally made the updates and hopefully we’ll have a release in the next few days.

1 Like

Thank you @Philipp_Rudiger , I have been testing the new release - the IPywidgets are now rendering inside a bokeh server app but I can’t manage to link together multiple widgets.
I opened an issue here: lost interaction between ipywidgets when wrapped into bokeh · Issue #39 · bokeh/ipywidgets_bokeh · GitHub
The slider is supposed to update the mapcanvas zoom level, but seem the interaction provided by jslink is lost (the same example code was working using previous release of bokeh+ipywidgets)

from ipywidgets_bokeh import IPyWidget
import ipywidgets as widgets

from bokeh.layouts import row
from bokeh.plotting import curdoc
from ipyleaflet import Map, basemaps
from ipywidgets import jslink

m = Map(center=(46.01, 6.16), zoom=12, basemap=basemaps.Stamen.Terrain)
zoom_slider = widgets.IntSlider(description='Zoom level:', min=0, max=15, value=7)
jslink((zoom_slider, 'value'), (m, 'zoom'))

slider_wrapper = IPyWidget(widget=zoom_slider, width=600, height=400)
map_wrapper = IPyWidget(widget=m, width=600, height=400)


doc = curdoc()
doc.add_root(row(slider_wrapper, map_wrapper))

Can’t manage to get a basic example working. The IPywidgets are rendered correctly into a bokeh server app, but the linking between widgets is lost.

For the code above, see running demo here: https://bokeh.epinux.com/ipw

Thanks for any help!

cc @Philipp_Rudiger

1 Like

There has been no progress on this so far. Just adding a comment to avoid the issue to get forgotten :slight_smile:

This issue lost interaction between ipywidgets when wrapped into bokeh · Issue #39 · bokeh/ipywidgets_bokeh · GitHub should be labeled as a Bug. As it is now the ipywidgets_bokeh library is in a broken state and can not be used with the recently released bokeh and with the latest stable ‘pip/conda’ installed dependencies.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.