What am I doing wrong with librosa?

82 views
Skip to first unread message

Luk Lukas

unread,
Feb 14, 2025, 4:47:31 PMFeb 14
to librosa
Hi,
Please accept my emotional email, but it seems I am doing something wrong with librosa that I am fall every step I tried to use it. I wish to use librosa in my research for voice recognition, nothing fancy spectrogram, mfcc, etc.

I took fresh windows 11 installation, fresh Python 3.13 with IDLE, installed fresh librosa via pip with all dependiences. Simple program like from examples:

import librosa
y,sr = librosa.load('test.mp3')

Fail #1
Soxr which is underhood of librosa fails to load its library soxr_ext. It took me while to troubleshoot this, I found a problem between soxr 0.5.0.post1 and 0.5.0, something in release notes about not finding libraries properly. But actually it was 0.5.0.post1 in my system, after downgrading to 0.5.0 first line of code did not fail. I know development of soxr is not made by librosa dev team, but it is strange that nobody noticed that?

Fail #2
Librosa.load failed just because 'aifc' is removed Python 3.13 but it is oficially deprecated since 3.11. Nobody has ever had this problem? I do not feel competent enought how to fix this, I just downgraded to Python 3.12, problem is gone. I am pretty sure I wiped all Python 3.13 artifacts from system so I had to install librosa from scratch but accidently Fail #1 is also gone. Python 3.13 was released in November 2024, and since that time nobody has such issues?

Fail #3
Librosa.load hanged during loading file. At the begining I assumed it may takes a while to precompile something as it is clean installation, but after 5 minutes I gave up. There are many discussion threads in internet saying sometimes load in librosa is slow because "something else" is missing and "some slow legacy" mechanism is used. So I converted my sample from mp3 to uncompressed wav, the format which requires just copying bytes from file to memory. Loading wav also tooks surprising long, actually I do not know if it success or I just silently kill process without waiting for return prompt. I tried to measure how long it takes to load wav file, with time module, then I realize it actually never ends! I pressed Ctrl-C and then I got interesting stack dump, there was exception during load and then while exception there was another exception which somehow deadlocked the python engine.

Please tell me if I am doing something wrong with librosa, I really wish to use it in my work.

Brian McFee

unread,
Feb 14, 2025, 4:58:25 PMFeb 14
to librosa
The current stable release of librosa (0.10.2) predates python 3.13, and does not claim to support it.  We have a pre-release up now (pip install --pre librosa) that does support 3.13, though there are a couple of caveats that come with this due to problems higher up in our dependency chain.  We're blocked on putting out a proper release until the upstream dependency issues are resolved, but the pre-release should work as long as you follow the instructions in the github release notes: https://github.com/librosa/librosa/releases/tag/0.11.0rc0 for details.

For soxr, this is the first I've heard of such an issue.  You'd probably do best to take it up with the soxr-python devs directly: https://github.com/dofuuz/python-soxr

For librosa.load hanging during load, it's hard to diagnose without actually seeing your stack trace or having more details about your installation environment.  The most common cause for this, as we note in the documentation https://librosa.org/doc/latest/troubleshooting.html#import-librosa-hangs-indefinitely has to do with filesystem permissions that most often seem to crop up on windows.

One thing that might help simplify everything here, if it's an option for you, is to use a conda environment instead of pypi/pip.  If you need python 3.13, you'd still have to install the librosa 0.11.0rc0 version via pypi, but having the rest of the dependencies installed by conda would narrow down some of the platform compatibility issues.
Reply all
Reply to author
Forward
0 new messages