LegendItem module not found when rendering multiline plot

This worked fine on ubuntu 14. Computer died, ported to new ubuntu 16. Same code still works fine when rendering a gridplot without legend instead.
Error:

Bokeh Error

 Module
`LegendItem' does not exists. The problem may be two fold. Either a model was requested that's available in an extra bundle, e.g. a widget, or a custom model was requested, but it wasn't registered before first usage.

python:
if plot == ‘multi’:
p = figure(x_axis_type=“datetime”,plot_width=1000, plot_height=800, title=title)
p.grid.grid_line_alpha = 0.5
p.xaxis.axis_label = ‘Date (m-d)’
p.yaxis.axis_label = ‘Number of calls per day’
p.ygrid.band_fill_color = “olive”
p.ygrid.band_fill_alpha = 0.1
for k,v in unstacked.items():
if k in agencyList:
p.line(x=unstacked[‘Date’].tolist(), y=unstacked[k].tolist(), color=agencydict[k], legend=k)
#p.line(x, y, color=‘navy’)
#p.circle(x, y, color=‘navy’)
#p = TimeSeries(unstacked, x_mapper_type=‘datetime’, xlabel=‘Date’, legend=True, title=title, ylabel=‘Number of calls per day’)
script, div = components(p)
return render_template(‘graph.html’, script=script, div=div)

``

in graph.html:
{% extends “base.html” %}
{% block title %} plot {% endblock %}

{% block head %}

{{ script | safe }}

{% endblock %}

{% block content %}

{{ div | safe }}

``

LegendItem is a recent addition in 0.12.3, but you are loading CDN resources from 0.12.2, which does not have it. That's the cause of the error. You need to update the CDN links in your template, or preferably, use a Resources object to automatically generate the JS and CSS with the appropriate version every time. Alternatively, you can downgrade your Bokeh install to version 0.12.2 as well.

Thanks,

Bryan

···

On Nov 10, 2016, at 12:17 PM, natasha <[email protected]> wrote:

This worked fine on ubuntu 14. Computer died, ported to new ubuntu 16. Same code still works fine when rendering a gridplot without legend instead.
Error:
Bokeh Error
Module `LegendItem' does not exists. The problem may be two fold. Either a model was requested that's available in an extra bundle, e.g. a widget, or a custom model was requested, but it wasn't registered before first usage.

python:
if plot == 'multi':
        p = figure(x_axis_type="datetime",plot_width=1000, plot_height=800, title=title)
        p.grid.grid_line_alpha = 0.5
        p.xaxis.axis_label = 'Date (m-d)'
        p.yaxis.axis_label = 'Number of calls per day'
        p.ygrid.band_fill_color = "olive"
        p.ygrid.band_fill_alpha = 0.1
        for k,v in unstacked.items():
            if k in agencyList:
                p.line(x=unstacked['Date'].tolist(), y=unstacked[k].tolist(), color=agencydict[k], legend=k)
        #p.line(x, y, color='navy')
        #p.circle(x, y, color='navy')
        #p = TimeSeries(unstacked, x_mapper_type='datetime', xlabel='Date', legend=True, title=title, ylabel='Number of calls per day')
        script, div = components(p)
        return render_template('graph.html', script=script, div=div)

in graph.html:
{% extends "base.html" %}
{% block title %} plot {% endblock %}

{% block head %}
    <link rel="stylesheet" href="//cdn.pydata.org/bokeh/release/bokeh-0.12.2.min.css" type="text/css" />
    <script type="text/javascript" src="//cdn.pydata.org/bokeh/release/bokeh-0.12.2.min.js"></script>

    {{ script | safe }}
{% endblock %}

{% block content %}
<div style="display:table; margin:0 auto;">
      {{ div | safe }}
</div>

--
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/3fd8392f-daa4-4ad6-b056-b52666db8ede%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thank you Bryan, that was exactly it - didn’t realize I had a newer bokeh version already (it had been less than a month or 2? since installing it). Will look into the Resources object moving forward.
Thanks again.

···

On Thursday, November 10, 2016 at 1:28:00 PM UTC-5, Bryan Van de ven wrote:

LegendItem is a recent addition in 0.12.3, but you are loading CDN resources from 0.12.2, which does not have it. That’s the cause of the error. You need to update the CDN links in your template, or preferably, use a Resources object to automatically generate the JS and CSS with the appropriate version every time. Alternatively, you can downgrade your Bokeh install to version 0.12.2 as well.

Thanks,

Bryan

On Nov 10, 2016, at 12:17 PM, natasha [email protected] wrote:

This worked fine on ubuntu 14. Computer died, ported to new ubuntu 16. Same code still works fine when rendering a gridplot without legend instead.

Error:

Bokeh Error

Module `LegendItem’ does not exists. The problem may be two fold. Either a model was requested that’s available in an extra bundle, e.g. a widget, or a custom model was requested, but it wasn’t registered before first usage.

python:

if plot == ‘multi’:

    p = figure(x_axis_type="datetime",plot_width=1000, plot_height=800, title=title)
    p.grid.grid_line_alpha = 0.5
    p.xaxis.axis_label = 'Date (m-d)'
    p.yaxis.axis_label = 'Number of calls per day'
    p.ygrid.band_fill_color = "olive"
    p.ygrid.band_fill_alpha = 0.1
    for k,v in unstacked.items():
        if k in agencyList:
            p.line(x=unstacked['Date'].tolist(), y=unstacked[k].tolist(), color=agencydict[k], legend=k)    
    #p.line(x, y, color='navy')
    #p.circle(x, y, color='navy')
    #p = TimeSeries(unstacked, x_mapper_type='datetime', xlabel='Date', legend=True, title=title, ylabel='Number of calls per day')
    script, div = components(p)
    return render_template('graph.html', script=script, div=div)

in graph.html:

{% extends “base.html” %}

{% block title %} plot {% endblock %}

{% block head %}

<link rel="stylesheet" href="//[cdn.pydata.org/bokeh/release/bokeh-0.12.2.min.css](http://cdn.pydata.org/bokeh/release/bokeh-0.12.2.min.css)" type="text/css" />
<script type="text/javascript" src="//[cdn.pydata.org/bokeh/release/bokeh-0.12.2.min.js](http://cdn.pydata.org/bokeh/release/bokeh-0.12.2.min.js)"></script>
{{ script | safe }}

{% endblock %}

{% block content %}

  {{ div | safe }}


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/3fd8392f-daa4-4ad6-b056-b52666db8ede%40continuum.io.

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