Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't import soundfile python

Tags:

while using import soundfile on wither python3 or python I am getting:

Traceback (most recent call last): File "", line 1, in File "/home/erezsh/.local/lib/python3.6/site-packages/soundfile.py", line 142, in raise OSError('sndfile library not found') OSError: sndfile library not found

I found this post which did not help because I am using soundfile and not pysoundfile and the link it offers is broken.

Also, here I could not find a solution since I have installed using pip install SoundFile.

I am using Ubuntu shell on windows. Is this of any importance?

How do I solve this?

like image 441
havakok Avatar asked Mar 10 '19 10:03

havakok


People also ask

How to install soundfile in Python?

SoundFile depends on the Python packages CFFI and NumPy, and the system library libsndfile. In a modern Python, you can use pip install soundfile to download and install the latest release of SoundFile and its dependencies. On Windows and OS X, this will also install the library libsndfile.

What is sound file library in Python?

00:00 soundfile is a powerful library that we've already used to read WAV files for the python-sounddevice example. Any file format supported by libsndfile (lib sound file) can be handled by soundfile . Even though soundfile won't play audio for you, it can be used to convert between all these different types.


1 Answers

You need to install the needed library:

On Linux, you need to install libsndfile using your distribution’s package manager, for example sudo apt-get install libsndfile1.

From PyPI

like image 87
handras Avatar answered Sep 21 '22 19:09

handras