Skip to content

push_notebook does not work in Google Colaboratory #9302

@sirbiscuit

Description

@sirbiscuit

Hello!

I tried to create an interactive plot with bokeh in Google Colab. The following code renders a scatter plot as expected:

from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
from bokeh.io import output_notebook, push_notebook, show
import numpy as np

output_notebook(hide_banner=True)

source = ColumnDataSource(data=dict(x=np.random.rand(10), y=np.random.rand(10)))
p = figure(output_backend="webgl")
scatter = p.scatter(source=source, x='x', y='y')
handle = show(p, notebook_handle=True)

Changing the data and calling push_notebook should change the positions of the points in the scatter plot:

scatter.data_source.data['x'] = np.random.rand(10)
scatter.data_source.data['y'] = np.random.rand(10)
push_notebook(handle)

Instead, the notebook crashes ("Runtime disconnected"). This happens with bokeh version 1.3.4. You can find a demo of the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions