AttributeError: unexpected attribute 'overlay' to CrosshairTool

Hi All!

Trying to use the linked CrosshairTools functionality. When I run the example on GitHub I’m hitting the following error

Traceback (most recent call last):
  File "test.py", line 381, in <module>
    p1.add_tools(CrosshairTool(overlay=[width, height]))
  File "/Users/x/opt/anaconda3/lib/python3.9/site-packages/bokeh/model/model.py", line 128, in __init__
    super().__init__(**kwargs)
  File "/Users/x/opt/anaconda3/lib/python3.9/site-packages/bokeh/core/has_props.py", line 206, in __init__
    setattr(self, name, value)
  File "/Users/x/opt/anaconda3/lib/python3.9/site-packages/bokeh/core/has_props.py", line 236, in __setattr__
    self._raise_attribute_error_with_matches(name, properties)
  File "/Users/x/opt/anaconda3/lib/python3.9/site-packages/bokeh/core/has_props.py", line 272, in _raise_attribute_error_with_matches
    raise AttributeError(f"unexpected attribute {name!r} to {self.__class__.__name__}, {text} attributes are {nice_join(matches)}")
AttributeError: unexpected attribute 'overlay' to CrosshairTool, possible attributes are description, dimensions, js_event_callbacks, js_property_callbacks, line_alpha, line_color, line_width, name, subscribed_events, syncable, tags or toggleable

I have a feeling that something changed in the version of Bokeh that is not reflected in this particular example or perhaps something is wrong in my setup?

Any recommendations?

Many thanks in advance!

The example you linked is from branch-3.1 so it has been updated to work with Bokeh 3.0+ The most likely explanation is that your version of Bokeh is older than that. You can upgrade your Bokeh version or else refer to the exampe on a branch suitable for your installed version, e.g. branch-2.4 perhaps.

Many thanks Bryan!

I’m switching to the 3.0.3 version now but for some reason I’m hitting bokeh.core.serialization.SerializationError: can’t serialize <class ‘pandas.core.arrays.floating.FloatingArray’> when I issue show(...)

Do you happen to know what should be done to avoid this issue?

I tried 2.4.3 of Bokeh (with the identical Pandas version of 1.5.2 that was used with Bokeh 3.0.3) and it appears that this combination is not hitting the issue with the same code.

Any help would be extremely appreciated as I really like to use the linked crosshair tool feature. I can stick to 2.4.3 if there’s a way to achieve this on that version. Otherwise if you have recommendations on how to mitigate the issue that I’m hitting on 3.1, that would be incredibly helpful as well.

Many thanks in advance!

@trxsi The most helpful thing would be if you can provide a complete Minimal Reproducible Example that can be run to investigate directly. I can’t really speculate without that.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.