Luis Ramon Ramirez Rodriguez Luis Ramon Ramirez Rodriguez - 4 months ago 21
Linux Question

No module named objects [bokeh]

I'm trying to run this script:

#Code will be significantly simplified in the 0.4 release
import time
from bokeh.objects import GlyphRenderer
renderer = [r for r in curplot().renderers if isinstance(r, GlyphRenderer)][0]
ds = renderer.data_source
while True:
df = pd.io.json.read_json(url+json_call)
ds.data["x"] = x+N*i
ds.data["y"] = df.rssi
ds._dirty = True
session().store_obj(ds)
time.sleep(1.5)
i+=1


from:
https://www.continuum.io/content/painless-streaming-plots-bokeh

but at this line:

from bokeh.objects import GlyphRenderer


I got:

No module named objects


The version I'm using is

0.11.1

On linux mint 17.1

zmo zmo
Answer

did you try installing bokeh before trying the examples? If not, just run:

pip install bokeh

and try your script again.


if it does not work, it's likely that the bokeh sources changed, so you might want to change the

from bokeh.objects import GlyphRenderer

into

from bokeh.models.renderers import GlyphRenderer

cf the source code


At the first line of your example it states:

#Code will be significantly simplified in the 0.4 release

which means that the example's code was already about to be deprecated at the time of the writing of the tutorial.

So instead of copy/pasting that code, you should try to understand how it works, and recreate it using the documentation and sources:

have fun!