scikits.audiolab on Ubuntu Oneiric - ImportError: No module named _sndfile

前端 未结 3 724
独厮守ぢ
独厮守ぢ 2021-01-11 23:46

Okay, so I wanted to do some basic signal processing in Python and found this great library called scikits.audiolab.

No PPA anywhere to be found. Oh wel

相关标签:
3条回答
  • 2021-01-12 00:07

    I you don't want to have the warning about alsa headers, just install the lib.

    sudo apt-get install libasound2-dev

    That worked for me..

    0 讨论(0)
  • 2021-01-12 00:13

    Edit: I just realized this is not the case as pysndfile seems to be bundled... I shouldn't be answering stuff the first thing in the morning ;)

    Answer to 1: Sndfile is a c library, you most probably need to install the python wrapper for it: http://code.google.com/p/libsndfile-python/

    0 讨论(0)
  • 2021-01-12 00:20

    Someone suggested I check ldd _sndfile.so. Did just that and got

        linux-vdso.so.1 =>  (0x00007fffd3dea000)
        libsndfile.so.1 => /usr/lib/x86_64-linux-gnu/libsndfile.so.1 (0x00007f2bfbb5b000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2bfb93e000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2bfb59e000)
        libFLAC.so.8 => /usr/lib/x86_64-linux-gnu/libFLAC.so.8 (0x00007f2bfb354000)
        libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007f2bfae85000)
        libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007f2bfac58000)
        libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007f2bfaa51000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2bfa7cd000)
    

    Interesting! A bunch of file format libraries are also referenced, ones that I probably do not have installed.

    Did sudo aptitude install flac vorbis-tools and voila!

    In [1]: from scikits.audiolab import sndfile
    /usr/local/lib/python2.7/dist-packages/scikits.audiolab-0.11.0-py2.7-linux-x86_6                                     
    4.egg/scikits/audiolab/soundio/play.py:48: UserWarning: Could not import alsa ba                                     
    ckend; most probably, you did not have alsa headers when building audiolab
    warnings.warn("Could not import alsa backend; most probably, "
    

    I can probably ignore that warning about missing ALSA support for now as it's probably used for local recording and playback - and this is a server anyway.

    It would have been a whole lot easier if the lack of libFLAC, libvorbis and libvorbisenc had triggered a build-time failure in the build scripts of scikits.audiolab... After all, the final error message mentions nothing of those libraries.

    0 讨论(0)
提交回复
热议问题