Question

I'm trying to install the pysox package using pip (easy_install throws exactly the same error) on Ubuntu 12.04.2 LTS.

$ pip install pysox
[...]
building 'pysox.sox' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c pysox/sox.c -o build/temp.linux-x86_64-2.7/pysox/sox.o

pysox/sox.c:227:17: fatal error: sox.h: No such file or directory

My system has installed:

$ dpkg --list | grep sox
ii  libsox-fmt-all      14.3.2-3    All SoX format libraries
ii  libsox-fmt-alsa     14.3.2-3    SoX alsa format I/O library
ii  libsox-fmt-ao       14.3.2-3    SoX Libao format I/O library
ii  libsox-fmt-base     14.3.2-3    Minimal set of SoX format libraries
ii  libsox-fmt-ffmpeg   14.3.2-3    SoX ffmpeg format library
ii  libsox-fmt-mp3      14.3.2-3    SoX MP3 format library
ii  libsox-fmt-oss      14.3.2-3    SoX OSS format I/O library
ii  libsox-fmt-pulse    14.3.2-3    SoX PulseAudio format I/O library
ii  libsox1b            14.3.2-3    SoX library of audio effects and processing
ii  sox                 14.3.2-3    Swiss army knife of sound processing

as well as the libasound2-plugins and libasound2-python packages. I even pulled the SoX source and added ~/sox/src/sox.h to my PATH, all to no avail. It's true that a find does not locate a sox.h, even though my binaries all seem in order. the pysox source does not seem contain sox.h either.

The pysox offical page states "Specifically you need sox.h in your include path and libsox.so and libsox.a in your link path."

But apart from compiling everything from source, I don't see how I can have those files just from the binary packages. Is it not possible to use normal package managers for this install, do I need to compile, link & include everything myself?

How does one install pysox properly on Debian/Ubuntu?

Was it helpful?

Solution 2

Okay, this was to be expected: forgot to install the dev package for SoX, namely libsox-dev. It wasn't obvious to me at first because the standard package is sox, and the lib packages are all prefaced with libsox-fmt (and there is very little documentation on this).

anyway, this is everything you'll need on a Debian machine to get the proper files in place for pip/easy_install to package manage your modules properly for SoX:

sudo apt-get install libasound2-plugins libasound2-python libsox-fmt-all libsox-dev sox

OTHER TIPS

In case it helps, I had the same issue but got errors using:

sudo apt-get install libasound2-plugins libasound2-python libsox-fmt-all libsox-dev sox

I did get it to work though by dropping the libasound requests, which no longer appear to be available.

This is what worked for me... the process, I think, was:

pip3 install sox

sudo apt-get install sox libsox-fmt-all 

sudo apt-get install sox libsox-dev 

pip3 install pysox

Only took me about 11 hours to work that out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top