-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Audio] Soundfile/libsndfile requirements too stringent for decoding mp3 files #5659
Comments
@sanchit-gandhi can you please also post the logs of git clone https://github.com/libsndfile/libsndfile.git
cd libsndfile/
autoreconf -vif
./configure --enable-werror
make
make install for this, some building libraries should be installed, for Debian/Ubuntu it's like: apt install autoconf autogen automake build-essential libasound2-dev \
libflac-dev libogg-dev libtool libvorbis-dev libopus-dev libmp3lame-dev \
libmpg123-dev pkg-config python but for other Linux distributions it might be different. When the binary is compiled, it should be put into location where cp /usr/local/lib/libsndfile.so /usr/local/lib/python3.7/dist-packages/_soundfile_data/
cp /usr/local/lib/libsndfile.la /usr/local/lib/python3.7/dist-packages/_soundfile_data/ Another solution is to not use |
Not sure if it may help, but you could also try updating |
@lhoestq @sanchit-gandhi. I encountered the same error (also on the TPU v4) when trying to run Downgrading soundfile with |
Maybe let's open an issue at https://github.com/bastibe/python-soundfile/issues in case they might know why you get |
This fixed the issue for me. After installing libsndfile as described above, I had to uninstall soundfile and re-install it with this command. |
Thank you so much for the comprehensive instructions @polinaeterna! Also confirming that they worked for me 🤗 In my case, I had to run several of these commands under "sudo" for privileges, but otherwise this workaround gave a successful
|
On a different machine, I also tried separately by first upgrading pip, then installing soundfile. This worked too! Thanks @lhoestq 🙌 |
Thanks, the solution solved my problem.
|
I had to run 'make install' or the It's working though! |
I had the same issue but it is working now! Thanks for all of your comments! |
I had the same issue on SageMaker but not on Colab; my approach to solve it was to match {"numpy", "numba"} exact versions
the numbers are from Colab where successfully I could do the job. |
It works and don't forget to "apt uninstall libsndfile1" after installing it from source code. |
Describe the bug
I'm encountering several issues trying to load mp3 audio files using
datasets
on a TPU v4.The PR #5573 updated the audio loading logic to rely solely on the
soundfile
/libsndfile
libraries for loading audio samples, regardless of their file type.The installation guide suggests that
libsndfile
is bundled in whensoundfile
is pip installed:datasets/docs/source/installation.md
Lines 70 to 71 in e1af108
However, just pip installing
soundfile==0.12.1
throws an error thatlibsndfile
is missing:Then:
Traceback (most recent call last):
Thus, I've followed the official instructions for installing the
soundfile
package from https://github.com/bastibe/python-soundfile#installation, which states thatlibsndfile
needs to be installed separately as:We can now import
soundfile
:We see that we have
soundfile==0.12.1
, which matches thedatasets[audio]
package constraints:datasets/setup.py
Lines 144 to 147 in e1af108
But we have
libsndfile==1.0.28
, which is too low for decoding mp3 files:datasets/src/datasets/config.py
Lines 136 to 138 in e1af108
Updating/upgrading the
libsndfile
doesn't change this:Is there any other suggestion for how to get a compatible
libsndfile
version? Currently, the version bundled with Ubuntuapt-get
is too low for decoding mp3 files.Maybe we could add this under
setup.py
such that we install the correctlibsndfile
version when we dopip install datasets[audio]
? IMO this would help circumvent such version issues.Steps to reproduce the bug
Environment described above. Loading mp3 files:
Expected behavior
Load mp3 files!
Environment info
datasets
version: 2.10.2.dev0The text was updated successfully, but these errors were encountered: