☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

ColumnDataSource cannot be shared across Documents

Community Support
ianhelle
ianhelle

I’ve hit this problem recently and looking for a bit of explanation of how I might be able to fix it.
We use Bokeh mostly with custom visualizations created from functions in imported Python modules (there is no module-level state and the ColumnDataSource objects are created a new objects each time.
When using these normally we have no problem.

In a new scenario we’d like to be able to save (temporarily, not to disk) the generated figures in a Python object. We’re calculating a bunch of results and Bokeh visualizations and then assigning each to an object attribute. Trying to show these again sometimes works and sometimes throws the error:
Models must be owned by only a single document, CDSView(id=xxxx....

These are all in a Jupyter notebook and trying to display them using bokeh.io.show (I’ve since read in a thread here that show() shouldn’t be called multiple times). Do I need to explicitly add these to a Document object? Should I be using something other than show() to display the figures?
I’m assuming that "show"ing a figure multiple times results in the entire Bokeh JS to be duplicated - and hence the colliding CSD ids.

I found this older thread (almost) useful

although doesn’t quite match our scenario.

⌁   Link to post
Bryan
Bryan

Are passing objects or app functions to show? i.e.

show(some_plot)

or

show(app_function)

? If the former, then that really shouldn’t happen, but a reproducer notebook would be needed to investigate. If the latter, then the app function must only add a unique, new set of Bokeh models to the doc every time it is called.

⌁   Link to post
ianhelle
ianhelle

It’s the former - something derived from LayoutDOM like a Column or Figure.
Repro notebook? Hmm. Currently it’s hooked up to query from live data but I could probably figure out something.

⌁   Link to post

End of archived discussion · Replies are disabled