RuntimeError: Models must be owned by only a single document (Bokeh 0.12.3) on refresh

Hi,

I am running a dashboard containing multiple plots and additional widgets. The exception is always thrown when reloading the page (Chrome and Firefox), never on initial load.

The causing element is always different - sometimes “Line”, sometimes “BasicTickFormatter”, sometimes “MonthTicker”, sometimes “Row”…

My dashboard is constructed with:

curdoc().add_periodic_callback(liveUpdate, 100)
curdoc().add_root(gridplot(...))


I tried the following with no success:

- Running Bokeh with "bokeh serve ." or "bokeh serve --show main.py"
- Using "Figure" instead of "figure" (as one of the related posts suggested)
Any ideas?

Am I doing something wrong?

Many thanks!

It's hard to say anything specific without a complete, minimal code example. But this points to your code accidentally re-using some objects across more than one session (reload). Are you creating some plot objects at module scope in some external modules that you are importing? That would probably cause this. You need to create completely new objects every time.

Bryan

···

On Nov 8, 2016, at 2:42 AM, Meir Tseitlin <[email protected]> wrote:

Hi,

I am running a dashboard containing multiple plots and additional widgets. The exception is always thrown when reloading the page (Chrome and Firefox), never on initial load.

The causing element is always different - sometimes "Line", sometimes "BasicTickFormatter", sometimes "MonthTicker", sometimes "Row"...

My dashboard is constructed with:
curdoc().add_periodic_callback(liveUpdate, 100)
curdoc().add_root(gridplot(...))

I tried the following with no success:
  • Running Bokeh with "bokeh serve ." or "bokeh serve --show main.py"
  • Using "Figure" instead of "figure" (as one of the related posts suggested)
  •
Any ideas?
Am I doing something wrong?

Many thanks!

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/2de6f533-1add-4ef0-be60-7ebaad0063aa%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

It was my own mistake…
I think I will leave this conversation for reference purposes.

I am creating a dashboard with container classes holding lists of widgets. Derived classes in Python share the lists members, unless initialized within init .

When reloading the page - previous session is not yet terminated (I guess), so the same widgets made their way into 2 different session.

···

On Tuesday, November 8, 2016 at 10:42:55 AM UTC+2, Meir Tseitlin wrote:

Hi,

I am running a dashboard containing multiple plots and additional widgets. The exception is always thrown when reloading the page (Chrome and Firefox), never on initial load.

The causing element is always different - sometimes “Line”, sometimes “BasicTickFormatter”, sometimes “MonthTicker”, sometimes “Row”…

My dashboard is constructed with:

curdoc().add_periodic_callback(liveUpdate, 100)
curdoc().add_root(gridplot(...))




I tried the following with no success:

  • Running Bokeh with “bokeh serve .” or “bokeh serve --show main.py”
  • Using “Figure” instead of “figure” (as one of the related posts suggested)
    Any ideas?

Am I doing something wrong?

Many thanks!

Yes, class attributes that are bokeh models will also cause this kind of situation as I described in the other response. It's a bit of a tricky point, so having the discussion archived is very helpful. Glad it's working for you now.

Thanks,

Bryan

···

On Nov 8, 2016, at 9:30 AM, Meir Tseitlin <[email protected]> wrote:

It was my own mistake...
I think I will leave this conversation for reference purposes.

I am creating a dashboard with container classes holding lists of widgets. Derived classes in Python share the lists members, unless initialized within __init__ .

When reloading the page - previous session is not yet terminated (I guess), so the same widgets made their way into 2 different session.

On Tuesday, November 8, 2016 at 10:42:55 AM UTC+2, Meir Tseitlin wrote:
Hi,

I am running a dashboard containing multiple plots and additional widgets. The exception is always thrown when reloading the page (Chrome and Firefox), never on initial load.

The causing element is always different - sometimes "Line", sometimes "BasicTickFormatter", sometimes "MonthTicker", sometimes "Row"...

My dashboard is constructed with:
curdoc().add_periodic_callback(liveUpdate, 100)
curdoc().add_root(gridplot(...))

I tried the following with no success:
  • Running Bokeh with "bokeh serve ." or "bokeh serve --show main.py"
  • Using "Figure" instead of "figure" (as one of the related posts suggested)
  •
Any ideas?
Am I doing something wrong?

Many thanks!

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/e362638e-572c-4784-95a9-eee15cf15682%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Can you tell me how you solved it. I am having trouble in my Jupyter Notebook . It shows the same error with different tool.

Hi,

The previous thread dod not involve notebooks, so you'll have to provide more information (ideally an example notebook to reproduce) in order for people to be able to help.

Thanks,

Bryan

···

On Mar 12, 2018, at 07:18, [email protected] wrote:

Can you tell me how you solved it. I am having trouble in my Jupyter Notebook . It shows the same error with different tool.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d8d5c132-27b3-4067-9542-dd386cb5ef1e%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi, getting the same error - RuntimeError: Models must be owned by only a single document, RangeSlider(id=‘8cc7892a-58b7-4eca-a933-27f059f9518d’, …) is already in a doc

Jupyter Notebook with data - https://drive.google.com/open?id=1nqCfJMm36WyzaykgbxEYYep0apBADRXu

Thanks

···

On Monday, 12 March 2018 21:22:55 UTC+5:30, Bryan Van de ven wrote:

Hi,

The previous thread dod not involve notebooks, so you’ll have to provide more information (ideally an example notebook to reproduce) in order for people to be able to help.

Thanks,

Bryan

On Mar 12, 2018, at 07:18, [email protected] wrote:

Can you tell me how you solved it. I am having trouble in my Jupyter Notebook . It shows the same error with different tool.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d8d5c132-27b3-4067-9542-dd386cb5ef1e%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

You need to removed the calls to show. It is never correct or appropriate to use “show” in a Bokeh server application, inside a notebook or anywhere else.

Thanks,

Bryan

···

On Jul 12, 2018, at 17:28, [email protected] wrote:

Hi, getting the same error - RuntimeError: Models must be owned by only a single document, RangeSlider(id=‘8cc7892a-58b7-4eca-a933-27f059f9518d’, …) is already in a doc

Jupyter Notebook with data - https://drive.google.com/open?id=1nqCfJMm36WyzaykgbxEYYep0apBADRXu

Thanks

On Monday, 12 March 2018 21:22:55 UTC+5:30, Bryan Van de ven wrote:

Hi,

The previous thread dod not involve notebooks, so you’ll have to provide more information (ideally an example notebook to reproduce) in order for people to be able to help.

Thanks,

Bryan

On Mar 12, 2018, at 07:18, [email protected] wrote:

Can you tell me how you solved it. I am having trouble in my Jupyter Notebook . It shows the same error with different tool.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d8d5c132-27b3-4067-9542-dd386cb5ef1e%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/fa1f14f2-408a-4b7e-9886-f4f2903084d1%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks a lot, Bryan, it worked!

···

On Friday, 13 July 2018 09:54:51 UTC+5:30, Bryan Van de ven wrote:

Hi,

You need to removed the calls to show. It is never correct or appropriate to use “show” in a Bokeh server application, inside a notebook or anywhere else.

Thanks,

Bryan

On Jul 12, 2018, at 17:28, [email protected] wrote:

Hi, getting the same error - RuntimeError: Models must be owned by only a single document, RangeSlider(id=‘8cc7892a-58b7-4eca-a933-27f059f9518d’, …) is already in a doc

Jupyter Notebook with data - https://drive.google.com/open?id=1nqCfJMm36WyzaykgbxEYYep0apBADRXu

Thanks

On Monday, 12 March 2018 21:22:55 UTC+5:30, Bryan Van de ven wrote:

Hi,

The previous thread dod not involve notebooks, so you’ll have to provide more information (ideally an example notebook to reproduce) in order for people to be able to help.

Thanks,

Bryan

On Mar 12, 2018, at 07:18, [email protected] wrote:

Can you tell me how you solved it. I am having trouble in my Jupyter Notebook . It shows the same error with different tool.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d8d5c132-27b3-4067-9542-dd386cb5ef1e%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/fa1f14f2-408a-4b7e-9886-f4f2903084d1%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Then, what shall we use to show bokeh plot in a notebook?

It’s described here to use .show()

https://bokeh.pydata.org/en/latest/docs/user_guide/notebook.html

Best,

···

On Friday, 13 July 2018 05:24:51 UTC+1, Bryan Van de ven wrote:

Hi,

You need to removed the calls to show. It is never correct or appropriate to use “show” in a Bokeh server application, inside a notebook or anywhere else.

Thanks,

Bryan

On Jul 12, 2018, at 17:28, [email protected] wrote:

Hi, getting the same error - RuntimeError: Models must be owned by only a single document, RangeSlider(id=‘8cc7892a-58b7-4eca-a933-27f059f9518d’, …) is already in a doc

Jupyter Notebook with data - https://drive.google.com/open?id=1nqCfJMm36WyzaykgbxEYYep0apBADRXu

Thanks

On Monday, 12 March 2018 21:22:55 UTC+5:30, Bryan Van de ven wrote:

Hi,

The previous thread dod not involve notebooks, so you’ll have to provide more information (ideally an example notebook to reproduce) in order for people to be able to help.

Thanks,

Bryan

On Mar 12, 2018, at 07:18, [email protected] wrote:

Can you tell me how you solved it. I am having trouble in my Jupyter Notebook . It shows the same error with different tool.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d8d5c132-27b3-4067-9542-dd386cb5ef1e%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/fa1f14f2-408a-4b7e-9886-f4f2903084d1%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

show should be used in notebooks to show an Application object, or a function that defines an app. My recollection is that show was being called *inside* the app code, and that is not a valid thing do.

Looking briefly at your notebook, there is definitely one thing you should change. You should always create a CDS, then later update the existing .data property of that CDS. It is not good practice to create new entire CDS objects and swap them out. So your "make_dataset_fuel" should just return a plain Python dict with the data, and you should use that dict to update an existing CDS. This is how every example in the repo and docs demonstrate data updates.

Thanks,

Bryan

···

On Dec 19, 2018, at 08:21, [email protected] wrote:

Then, what shall we use to show bokeh plot in a notebook?

It's described here to use .show()
https://bokeh.pydata.org/en/latest/docs/user_guide/notebook.html

Best,

On Friday, 13 July 2018 05:24:51 UTC+1, Bryan Van de ven wrote:
Hi,

You need to removed the calls to show. It is never correct or appropriate to use "show" in a Bokeh server application, inside a notebook or anywhere else.

Thanks,

Bryan

On Jul 12, 2018, at 17:28, ranjan...@gmail.com wrote:

Hi, getting the same error - RuntimeError: Models must be owned by only a single document, RangeSlider(id='8cc7892a-58b7-4eca-a933-27f059f9518d', ...) is already in a doc

Jupyter Notebook with data - Bokeh Proj Query - Google Drive

Thanks

On Monday, 12 March 2018 21:22:55 UTC+5:30, Bryan Van de ven wrote:
Hi,

The previous thread dod not involve notebooks, so you'll have to provide more information (ideally an example notebook to reproduce) in order for people to be able to help.

Thanks,

Bryan

> On Mar 12, 2018, at 07:18, neejai.n...@gmail.com wrote:
>
> Can you tell me how you solved it. I am having trouble in my Jupyter Notebook . It shows the same error with different tool.
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d8d5c132-27b3-4067-9542-dd386cb5ef1e%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/fa1f14f2-408a-4b7e-9886-f4f2903084d1%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a703506c-b675-4e02-923d-239cb6022b67%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

I’ve run into that error with Jupyter notebooks, though with a non-server Bokeh server application. The workaround I’ve found is restarting the kernel. It seemed like it might have to do with assigning a plot to a variable in one frame and assigning glyphs and calling show in separate frames, and running cells out of order.

IMO The possibility for out-of-order execution is the worst mis-feature of notebooks. It is a nightmare to integrate with.

Bryan

···

On Dec 19, 2018, at 08:59, Dan Kovacek <[email protected]> wrote:

I've run into that error with Jupyter notebooks, though with a non-server Bokeh server application. The workaround I've found is restarting the kernel. It seemed like it might have to do with assigning a plot to a variable in one frame and assigning glyphs and calling show in separate frames, and running cells out of order.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAHzmd5GhJSFOEjycu-v76bCTekuYMSTx1PyuG-f6W3WnsdSZLg%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.