Repository: librosa/librosa

Issue:
Can Python 3.12 installation be supported
I try using`pip3.12 install librosa` is error，May I ask when we can support it
![image](https://github.com/librosa/librosa/assets/29832297/50bc21fe-1a31-41ab-9c9b-dff49073eb4d)



Discussion:
Your traceback provides the answer to this question: some of the dependencies (notably numba) do not yet support python 3.12, so we can't either.
Understood, thank you for your reply
On numba [0.59 milestone](https://github.com/numba/numba/milestone/73) there is [this](https://github.com/numba/numba/issues/9197) PR open which tracks python 3.12 support. It looks like it's going to be supported soon.
Looks like there's now a release candidate for numba, so they'll beat us to the next milestone.  I've added this to the 0.10.2 docket.
Note that Python 3.12 doesn't come with setuptools installed by default, so it may be good to add that to the requirements, otherwise imports of pkg_resources will give errors.
> Note that Python 3.12 doesn't come with setuptools installed by default, so it may be good to add that to the requirements, otherwise imports of pkg_resources will give errors.

This shouldn't be necessary since we already merged #1765 

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -177,7 +177,7 @@ def reset_mpl(gallery_conf, fname):
     "matplotlib": ("https://matplotlib.org/stable/", None),
     "sklearn": ("https://scikit-learn.org/stable/", None),
     "resampy": ("https://resampy.readthedocs.io/en/stable/", None),
-    "soundfile": ("https://pysoundfile.readthedocs.io/en/latest", None),
+    "soundfile": ("https://python-soundfile.readthedocs.io/en/latest", None),
     "samplerate": ("https://python-samplerate.readthedocs.io/en/latest/", None),
     "pyrubberband": ("https://pyrubberband.readthedocs.io/en/stable/", None),
     "pooch": ("https://www.fatiando.org/pooch/latest/", None),


Test patch:
diff --git a/tests/test_core.py b/tests/test_core.py
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -13,6 +13,7 @@
 except:
     pass
 
+import sys
 import soundfile
 import audioread.rawread
 import librosa
@@ -1227,7 +1228,10 @@ def test_pyin_multi():
     assert np.allclose(vpall[1], vp1)
 
 
+@pytest.mark.skipif(sys.platform == "darwin", reason="Skip on OSX due to openblas issue")
 def test_pyin_multi_center():
+    # Note: this test has issues on OSX with libopenblas 0.3.26,
+    # so we disable it for now.  We may re-enable it some time in the future.
     y = np.stack([librosa.tone(440, duration=1.0), librosa.tone(560, duration=1.0)])
 
     # Taper the signal
@@ -1236,19 +1240,19 @@ def test_pyin_multi_center():
     # Filter it
     y = y * h[np.newaxis, :]
 
-    # Disable nans so we can use allclose checks
     fleft, vleft, vpleft = librosa.pyin(
-        y, fmin=100, fmax=1000, center=False, fill_na=-1
+        y, fmin=100, fmax=1000, center=False
     )
-    fc, vc, vpc = librosa.pyin(y, fmin=100, fmax=1000, center=True, fill_na=-1)
+    fc, vc, vpc = librosa.pyin(y, fmin=100, fmax=1000, center=True)
 
     # Centering will pad by half a frame on either side
     # hop length is one quarter frame
     # ==> match on 2:-2
 
-    assert np.allclose(fleft, fc[..., 2:-2])
-    assert np.allclose(vleft, vc[..., 2:-2])
+    # Loosening tolerances here to account for platform differences
     assert np.allclose(vpleft, vpc[..., 2:-2])
+    assert np.allclose(vleft, vc[..., 2:-2])
+    assert np.allclose(fleft, fc[..., 2:-2], equal_nan=True), np.max(np.abs(fleft - fc[..., 2:-2]))
 
 
 def test_pyin_chirp():
diff --git a/tests/test_util.py b/tests/test_util.py
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -1036,7 +1036,7 @@ def test_nnls_vector(dtype_A, dtype_B):
     srand()
 
     # Make a random basis
-    A = np.random.randn(5, 7).astype(dtype_A)
+    A = np.random.randn(7, 5).astype(dtype_A)
 
     # Make a random latent vector
     x = np.random.randn(A.shape[1]) ** 2