1

I'm trying to create a webapp using bokeh. Mostly, it will consist of markdown text and some figures. Right now I'm stuck a getting voilà to show two bokeh figures side by side. Within the notebook everything runs smoothly, but in the voilà visualization I see errors like

Javascript Error: Error rendering Bokeh model: could not find #5db0eeb2-830f-4e00-b6fe-552a45536513 HTML tag

Now, if I try in classic jupyter notebook (within jupyter-lab Help -> Launch Classic Notebook), then it renders fine. However, when it is served from github, I get again javascript errors.

A MWE within jupyterlab but non-working in voilà is:

import numpy as np
import ipywidgets as widgets
import bokeh.plotting
from bokeh.io import output_notebook, show
from bokeh.models import ColumnDataSource, Line

output_notebook()

t = np.arange(10)
signal = np.arange(10)

f_1 = bokeh.plotting.figure(plot_width=400, plot_height=300, toolbar_location=None)
data_source_1 = ColumnDataSource(data=dict(t=t, signal=signal))
f_1.line(x='t', y='signal', source=data_source_1)

out_1 = widgets.Output()
with out_1:
    show(f_1)

f_2 = bokeh.plotting.figure(plot_width=400, plot_height=300, toolbar_location=None)
data_source_2 = ColumnDataSource(data=dict(t=t, signal=2*signal))
f_2.line(x='t', y='signal', source=data_source_2)

out_2 = widgets.Output()
with out_2:
    show(f_2)

widgets.HBox([out_1, out_2])

This is meant to be part of mini-lecture on analog modulations: the classic notebook version works fine, but when I try to use voilà-served version (click the Voilà button there or just go to this other link) I hit the same problem.

Any clue?

manu
  • 1,333
  • 2
  • 11
  • 24
  • there is no more HBox in bokeh anymore. maybe this is the problem? Use Row – kağan hazal koçdemir Dec 28 '21 at 19:17
  • It looks like Bokeh does some non-standard things (i.e. does not follow jupyter widgets protocol) and does not currently work in Voila: https://github.com/voila-dashboards/voila/issues/244 however you may have some luck using https://github.com/bokeh/jupyter_bokeh as suggested in https://github.com/voila-dashboards/voila/issues/244#issuecomment-623783437 – krassowski Dec 29 '21 at 05:17
  • Thanks both for the quick reply. kağanhazalkoçdemir, I was trying to use *ipywidgets*'s HBox (rather than Bokeh's). @krassowski, you were right and it seems this is a bokeh thing. While perusing the URLs you pointed out I read this doesn't happen in plotly, so I decided to migrate :) It was fairly easy and plotly is also nice. – manu Dec 29 '21 at 19:32

0 Answers0