Search code examples
pythonbokeh

Python Bokeh Failing to import


I am trying to view Data using Bokeh with the below code but Bokeh is failing to import. I am using jupyter Notebook.

from bokeh.plotting import figure,show
from bokeh.model import HoverTool

TOOLTIPS = HoverTool(tooltips = [
    ("index", "$index"),
    ("(Wage,Value)", "(@Wage, @Value)"),
    ("Name", "@Name")]
)
p = figure(title="Soccer 2219", x_axis_label='Wage', y_axis_label='Value', plot_width = 700, plot_height = 700, tools=[TOOLTIPS])
p.circle('Wage', 'Value', size = 10, source = df1)
show(p)

Error message:

ImportError                               Traceback (most recent call last)
<ipython-input-1-c4834377f869> in <module>
      1 from bokeh.plotting import figure,show
----> 2 from bokeh.model import HoverTool
      3 
      4 TOOLTIPS = HoverTool(tooltips = [
      5     ("index", "$index"),

ImportError: cannot import name 'HoverTool' from 'bokeh.model'

Solution

  • Have you tried to check typos?

    from bokeh.models import HoverTool