scikits.audiolab on Ubuntu Oneiric - ImportError: No module named _sndfile
<p>Okay, so I wanted to do some basic signal processing in Python and found this great library called <code>scikits.audiolab</code>.</p>

<p>No PPA anywhere to be found. Oh well. I thought I could install it on my Ubuntu Oneiric server by simply</p>

<pre><code>sudo aptitude install libsndfile-dev
</code></pre>

<p>and then</p>

<pre><code>sudo easy_install scikits.audiolab
</code></pre>

<p>This, however, failed with</p>

<pre><code>error: sndfile (http://www.mega-nerd.com/libsndfile/) library not found.
Directories to search for the libraries can be specified in the
site.cfg file, in section [sndfile].
</code></pre>

<p>Wtf? Okay, queried the <code>libsndfile1-dev</code> file list:</p>

<pre><code>japsu@helios ~ $ apt-file list libsndfile1-dev
libsndfile1-dev: /usr/include/sndfile.h
libsndfile1-dev: /usr/include/sndfile.hh
libsndfile1-dev: /usr/lib/x86_64-linux-gnu/libsndfile.a
libsndfile1-dev: /usr/lib/x86_64-linux-gnu/libsndfile.la
libsndfile1-dev: /usr/lib/x86_64-linux-gnu/libsndfile.so
libsndfile1-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/sndfile.pc
[...]
</code></pre>

<p>Weird, libraries going into non-standard library directory? Stupid packager.</p>

<p>Oh well. Downloaded the source for <code>scikits.audiolab</code>, wrote a <code>site.cfg</code> like this:</p>

<pre><code>[sndfile]
include_dirs = /usr/include
library_dirs = /usr/lib/x86_64-linux-gnu/
sndfile_libs = sndfile
</code></pre>

<p>Now <code>python setup.py build</code> and <code>sudo setup.py install</code> completed successfully.</p>

<p>Next, fired up a Python shell, tried to <code>from scikits.audiolab import sndfile</code>:</p>

<pre><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "scikits/audiolab/__init__.py", line 25, in &lt;module&gt;
    from pysndfile import formatinfo, sndfile
  File "scikits/audiolab/pysndfile/__init__.py", line 1, in &lt;module&gt;
    from _sndfile import Sndfile, Format, available_file_formats, \
ImportError: No module named _sndfile
</code></pre>

<p>But:</p>

<pre><code>&gt;&gt; sys.path
['',
 '/usr/bin',
 '/usr/lib/pymodules/python2.7',
 '/usr/local/lib/python2.7/dist-packages/scikits.audiolab-0.11.0-py2.7-linux-x86_64.egg',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/IPython/Extensions',
 u'/home/japsu/.ipython']
</code></pre>

<p>And <code>_sndfile.so</code> found at <code>/usr/local/lib/python2.7/dist-packages/scikits.audiolab-0.11.0-py2.7-linux-x86_64.egg/scikits/audiolab/pysndfile/_sndfile.so</code>.</p>

<p>So, my question is,</p>

<ol>
<li>Wtf is going on? Why doesn't python find <code>_sndfile.so</code>?</li>
<li>Has anyone successfully used <code>scikits.audiolab</code> in 2011 on a 2011 Linux distro? How did you do it?</li>
<li>Are there any good alternative libraries for reading HUGE (like, 10 GB / 8 hours) WAV files chunk by chunk into NumPy?</li>
</ol>
