Repository: librosa/librosa

Issue:
librosa 0.10.2 is not compatible with matplotlib <3.5
***BEFORE POSTING A BUG REPORT*** Please look through [existing issues (both open and closed)](https://github.com/librosa/librosa/issues?q=is%3Aissue) to see if it's already been reported or fixed!


**librosa 0.10.2 is not imcompatible with matplotlib.colormap**
  When I try to user librosa.display, it reports the following error: cannot import name 'colormaps' from 'matplotlib'
![image](https://github.com/librosa/librosa/assets/51704570/d50df74f-c345-48ba-8953-b9b1efec3ff7)



**error code**
<!--
Example:
```
import librosa.display
import matplotlib.pyplot as plt
import numpy as np

-->
**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Software versions***

![image](https://github.com/librosa/librosa/assets/51704570/957530c7-9656-44f9-8b0e-c1df49c3b61f)

**Additional context**
I have tried to change the version of matplotlib, but it does not work. And the versions I have tried are: 2.0.0, 3.0.0

librosa 0.10.2 is not compatible with matplotlib <3.5
***BEFORE POSTING A BUG REPORT*** Please look through [existing issues (both open and closed)](https://github.com/librosa/librosa/issues?q=is%3Aissue) to see if it's already been reported or fixed!


**librosa 0.10.2 is not imcompatible with matplotlib.colormap**
  When I try to user librosa.display, it reports the following error: cannot import name 'colormaps' from 'matplotlib'
![image](https://github.com/librosa/librosa/assets/51704570/d50df74f-c345-48ba-8953-b9b1efec3ff7)



**error code**
<!--
Example:
```
import librosa.display
import matplotlib.pyplot as plt
import numpy as np

-->
**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Software versions***

![image](https://github.com/librosa/librosa/assets/51704570/957530c7-9656-44f9-8b0e-c1df49c3b61f)

**Additional context**
I have tried to change the version of matplotlib, but it does not work. And the versions I have tried are: 2.0.0, 3.0.0



Discussion:
Very strange. We don't currently test on 3.4.3, but we do test on 3.3.0, which is the oldest supported matplotlib for us  there haven't been any changes to the colormaps module between these versions that would have caused a problem like this. 

My guess is that your matplotlib installation is broken. Can you verify that it works properly outside of using librosa?
Yes, I think so. And I have tested the matplotlib package below:
![image](https://github.com/librosa/librosa/assets/51704570/c0789ddf-3bd2-4ae7-a62a-d6765b8b37eb)

Ok, thanks for checking.  I just looked into our test logs, and it turns out that the test environments have ended up in a configuration that never actually tests against any matplotlib older than 3.7!  So while we have a test environment set up for mpl 3.3, the tests don't actually execute.  Our display tests only run on 3.4 or higher, but somewhere along the way our build matrix updated such that no environment ships with that version.  As a result, the code I thought was being tested on old MPL was never actually running!  Sorry about that.

Bisecting out across matplotlib versions, it appears that any matplotlib>=3.5.0 will work, so upgrading mpl is the easiest solution I can recommend for now.

I think the easiest fix here is to bump the minimum mpl version and cut a post-release 0.10.2.post1.  I don't think this causes any problems for our other dependencies since mpl 3.5 works on py3.7.  I'll open a PR and test it out.
Very strange. We don't currently test on 3.4.3, but we do test on 3.3.0, which is the oldest supported matplotlib for us  there haven't been any changes to the colormaps module between these versions that would have caused a problem like this. 

My guess is that your matplotlib installation is broken. Can you verify that it works properly outside of using librosa?
Yes, I think so. And I have tested the matplotlib package below:
![image](https://github.com/librosa/librosa/assets/51704570/c0789ddf-3bd2-4ae7-a62a-d6765b8b37eb)

Ok, thanks for checking.  I just looked into our test logs, and it turns out that the test environments have ended up in a configuration that never actually tests against any matplotlib older than 3.7!  So while we have a test environment set up for mpl 3.3, the tests don't actually execute.  Our display tests only run on 3.4 or higher, but somewhere along the way our build matrix updated such that no environment ships with that version.  As a result, the code I thought was being tested on old MPL was never actually running!  Sorry about that.

Bisecting out across matplotlib versions, it appears that any matplotlib>=3.5.0 will work, so upgrading mpl is the easiest solution I can recommend for now.

I think the easiest fix here is to bump the minimum mpl version and cut a post-release 0.10.2.post1.  I don't think this causes any problems for our other dependencies since mpl 3.5 works on py3.7.  I'll open a PR and test it out.

Resolving patch:
diff --git a/librosa/version.py b/librosa/version.py
--- a/librosa/version.py
+++ b/librosa/version.py
@@ -6,7 +6,7 @@
 import importlib
 
 short_version = "0.10"
-version = "0.10.2"
+version = "0.10.2.post1"
 
 
 def __get_mod_version(modname):


Test patch:
diff --git a/tests/test_display.py b/tests/test_display.py
--- a/tests/test_display.py
+++ b/tests/test_display.py
@@ -16,7 +16,7 @@
 
 import pytest
 
-matplotlib = pytest.importorskip("matplotlib", minversion="3.4")
+import matplotlib
 
 STYLE = "default"