No module named objects [bokeh]

15,758

Solution 1

Note from maintainers: This answer is no longer relevant. The bokeh.objects module has not existed for years



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!

Solution 2

The objects module was deleted in commit 5b5d28304c5ea209e243af5943917fe494d9ef9c (v0.7.1) after being deprecated in 8bb4a2f1f43b39b869c508ef7aee69f7aabb46b8 (v0.7.0). The deprecation message reads: "use bokeh.models instead". I leave finding GlyphRenderer in the current codebase as an exercise for you.

Share:
15,758
Luis Ramon Ramirez Rodriguez
Author by

Luis Ramon Ramirez Rodriguez

Updated on June 08, 2022

Comments

  • Luis Ramon Ramirez Rodriguez
    Luis Ramon Ramirez Rodriguez almost 2 years

    Note from maintainers: This question is no longer relevant. The bokeh.objects module has not existed for years



    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

  • Luis Ramon Ramirez Rodriguez
    Luis Ramon Ramirez Rodriguez about 8 years
    using "from bokeh.models.renderers import GlyphRenderer" but know I get: "name 'curplot' is not defined" seems that the code alone won't work
  • zmo
    zmo about 8 years
    yup, I guess curplot() is defined else where, or is just for the sake of the example. I believe the documentation you're trying to copy from is just to show off principles and results, not really a base to build your own stuff upon.
  • zmo
    zmo about 8 years
    Or if you look at the example's full source code, maybe it's part of the * it imports from bokeh.plotting. cf github.com/quasiben/bokeh_examples