display.waveshow() return error when it's called without "color" attribute

166 views
Skip to first unread message

The Earnest Sylvia

unread,
Mar 19, 2024, 10:13:30 AM3/19/24
to librosa
I  believe the color attribute is not required for this function, but after I correctly loaded an audio and called librosa.display.waveshow(y, sr=sr), it returns error like this:
"""
Traceback (most recent call last):
  File "/Users/Sylvia_1/anaconda3/envs/forLibrosa/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-9-9fe4a8a9f0d7>", line 2, in <module>
    librosa.display.waveshow(y, sr=sr)
  File "/Users/Sylvia_1/anaconda3/envs/forLibrosa/lib/python3.11/site-packages/librosa/display.py", line 2042, in waveshow
    kwargs.setdefault("color", next(axes._get_lines.prop_cycler)["color"])
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: '_process_plot_var_args' object has no attribute 'prop_cycler'
"""
Therefore, I added a color attribute value and tried again, it works. The waveform was correctly plotted.

why is this?


Brian McFee

unread,
Mar 19, 2024, 10:16:41 AM3/19/24
to librosa
This issue has already been reported and resolved, see: https://github.com/librosa/librosa/issues/1754  - the fix will be included in the 0.10.2 release.

The problem is that we had been using a matplotlib API that was removed in version 3.8.0.  You can work around this for now by any of the following strategies:
  • roll back your matplotlib installation to 3.7
  • install the development version of librosa from github
  • explicitly set the color attribute when calling waveshow
Reply all
Reply to author
Forward
0 new messages