dubreuia / visual_midi

Converts a pretty midi sequence to a bokeh plot.
MIT License
58 stars 8 forks source link

Invalid bokeh attributes #11

Open Kapitan11 opened 1 year ago

Kapitan11 commented 1 year ago

Hey!

I wanted to check out the notebook example-01.ipynb with one of my midi files yet I've already run into error:

Cell In[5], line 7
      5 plotter = Plotter(preset, plot_max_length_bar=4)
      6 pm = PrettyMIDI("data/ghostbusters.mid")
----> 7 plotter.show_notebook(pm)

File (...)/python3.10/site-packages/Visual_MIDI-1.1.0-py3.10.egg/visual_midi/visual_midi.py:436
    429 def show_notebook(self, pm: PrettyMIDI):
    430     """
    431     Shows the pretty midi object as a plot file in the notebook.
    432 
    433       :param pm: the PrettyMIDI instance to plot
    434       :return: the bokeh plot layout
    435     """
--> 436     plot = self.plot(pm)
    437     output_notebook()
    438     show(plot)

File (...)/python3.10/site-packages/Visual_MIDI-1.1.0-py3.10.egg/visual_midi/visual_midi.py:223
    214     box = BoxAnnotation(bottom=pitch,
    215                         top=pitch + 1,
    216                         fill_color="gray",
   (...)
    220                         line_width=1,
...
    365 if not matches:
    366     matches, text = sorted(properties), "possible"
--> 368 raise AttributeError(f"unexpected attribute {name!r} to {self.__class__.__name__}, {text} attributes are {nice_join(matches)}")

AttributeError: unexpected attribute 'render_mode' to Label, possible attributes are angle, angle_units, background_fill_alpha, background_fill_color, border_line_alpha, border_line_cap, border_line_color, border_line_dash, border_line_dash_offset, border_line_join, border_line_width, coordinates, group, js_event_callbacks, js_property_callbacks, level, name, propagate_hover, subscribed_events, syncable, tags, text, text_align, text_alpha, text_baseline, text_color, text_font, text_font_size, text_font_style, text_line_height, text_outline_color, visible, x, x_offset, x_range_name, x_units, y, y_offset, y_range_name or y_units

It might be a package versioning issue (?). I hope it helps, I would love to play around with your package.

GerardvSchie commented 7 months ago

To temporarily fix it do:

pip install bokeh==2.4.3

Its a breaking change from a later bokeh version