
Hi,
I am trying to use the RangeTool in a Jupyter notebook, but I always get an “Uncaught (in promise) Error: models must be owned by only a single document” error. Here is a minimal code that reproduces the error:
from bokeh.io import output_notebook, show
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, DatetimeTickFormatter, RangeTool, Range1d
from bokeh.layouts import column
output_notebook()
timestamps = [1, 2, 3, 4, 5]
values = [10, 20, 30, 40, 50]
dummy_data = {'timestamp': timestamps, 'value': values}
source = ColumnDataSource(dummy_data)
x_range = Range1d(start=timestamps[0], end=timestamps[-1])
y_range = Range1d(start=min(values), end=max(values))
select = figure(x_axis_type="linear", x_range=x_range, y_range=y_range, tools="")
range_tool = RangeTool(x_range=x_range)
select.add_tools(range_tool)
select.line(x='timestamp', y='value', source=source)
show(select)
If I comment the line select.add_tools(range_tool), the plot is shown, so I guess the notebook is setup correctly. I work with Bokeh 3.3.0 and JupyterLab 3.6.3 in Firefox. I have tried essentially all the recommendations I could find without success. Any recommendations would be much appreciated.
Thanks, Kurt



