ImportError: cannot import name 'LegendItem'

Using Windows 10, Anaconda Navigator 1.6.3, Spyder 3.2.3 (version 3.2.4 not available for updating on Anaconda)

Installed bokeh on Spyder sing !pip install bokeh

Message said installed OK.

I’m doing homework and following the dots so far, instructions are to:

import bokeh
from bokeh.io import output_notebook

from bokeh.io import show
output_notebook ()
from bkcharts import Histogram, Scatter, BoxPlot

``

The last command is where it craps out:

Traceback (most recent call last):

File “”, line 1, in
from bkcharts import Histogram

File “E:\Anaconda\lib\site-packages\bkcharts_init_.py”, line 8, in
from .chart import Chart, defaults

File “E:\Anaconda\lib\site-packages\bkcharts\chart.py”, line 19, in
from bokeh.models import CategoricalAxis, DatetimeAxis, FactorRange, glyphs, Grid, HoverTool, Legend, LegendItem, LinearAxis, markers, Plot

ImportError: cannot import name ‘LegendItem’

Traceback (most recent call last):

File “”, line 1, in
from bkcharts import Histogram

File “E:\Anaconda\lib\site-packages\bkcharts_init_.py”, line 8, in
from .chart import Chart, defaults

File “E:\Anaconda\lib\site-packages\bkcharts\chart.py”, line 19, in
from bokeh.models import CategoricalAxis, DatetimeAxis, FactorRange, glyphs, Grid, HoverTool, Legend, LegendItem, LinearAxis, markers, Plot

ImportError: cannot import name ‘LegendItem’

``

Any suggestions how to fix this?

Hi,

The short answer is: don’t use bkcharts. It is completely unmaintained. There is basically nothing you could do in bkcharts that cab’t be done with core stable bokeh.plotting, or with the supported and maintained HoloViews API on top of Bokeh (http://holoviews.org/)

The longer answer is: when bkcharts was removed from core Bokeh, there was a period of time that a “compatibility shim” was provided so that code would not break immediately, and would print a deprecation warning. To do this, we had to have Bokeh depend bkcharts, which is really backwards from the way things should be. Now that the shim has been removed, bkcharts could be updated to depend on an old version of Bokeh. But everyone is overworked and no one has had the opportunity to do this. I’d be happy to help anyone who wants to take over maintenance of bkcharts or even just to update things for one new release. But the important point is as I mentioned: it would have to be an old version of Bokeh (maybe 0.12.6) that bkcharts gets pinned to, bkcharts does not work with newer versions of Bokeh, and probably never will unless someone volunteers to take it over. (Another reason to not use it at all at this point)

Bryan

···

On Oct 22, 2017, at 02:50, James R [email protected] wrote:

Using Windows 10, Anaconda Navigator 1.6.3, Spyder 3.2.3 (version 3.2.4 not available for updating on Anaconda)

Installed bokeh on Spyder sing !pip install bokeh

Message said installed OK.

I’m doing homework and following the dots so far, instructions are to:

import bokeh
from bokeh.io import output_notebook

from bokeh.io import show
output_notebook ()
from bkcharts import Histogram, Scatter, BoxPlot

``

The last command is where it craps out:

Traceback (most recent call last):

File “”, line 1, in
from bkcharts import Histogram

File “E:\Anaconda\lib\site-packages\bkcharts_init_.py”, line 8, in
from .chart import Chart, defaults

File “E:\Anaconda\lib\site-packages\bkcharts\chart.py”, line 19, in
from bokeh.models import CategoricalAxis, DatetimeAxis, FactorRange, glyphs, Grid, HoverTool, Legend, LegendItem, LinearAxis, markers, Plot

ImportError: cannot import name ‘LegendItem’

Traceback (most recent call last):

File “”, line 1, in
from bkcharts import Histogram

File “E:\Anaconda\lib\site-packages\bkcharts_init_.py”, line 8, in
from .chart import Chart, defaults

File “E:\Anaconda\lib\site-packages\bkcharts\chart.py”, line 19, in
from bokeh.models import CategoricalAxis, DatetimeAxis, FactorRange, glyphs, Grid, HoverTool, Legend, LegendItem, LinearAxis, markers, Plot

ImportError: cannot import name ‘LegendItem’

``

Any suggestions how to fix this?

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/16d08b3c-7682-4fdc-b131-de34803b8bd1%40continuum.io.

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

Thanks for the explanation Bryan.