Pyaudio library .Install.



  • Hi, I want to install pip install pyaudio but I have not been able every time I do it I get an error
      Running setup.py install for pyaudio ... error
    Command "/ usr / bin / python -u -c" import setuptools, tokenize; __ file __ = '/ tmp / pip-i nstall-1S0LTg / pyaudio / setup.py'; f = getattr (tokenize, 'open', open) (__file __); code = f.read (). replace ('\ r \ n', '\ n'); f.close (); exec (compile (code, file, 'exec')) "install - record /tmp/pip-record-soyc9h/install-record.txt --single-version-ext ernally-managed --compile "failed with error code 1 in / tmp / pip-install-1S0LTg / p yaudio /

    Can you help me install it?
    Many thanks
    B. Regards



  • The setup.py wants to compile _portaudiomodule.c. Your Omega2 doesn't have GCC installed, so it fails. See https://pypi.org/project/PyAudio/#files PyAudio-0.2.11.tar.gz, setup.py.

    Installing GCC is possible, see https://docs.onion.io/omega2-docs/c-compiler-on-omega.html. To get the above module to compile you'l also need the alsa development packages (alsa-lib). If linking fails, try to cross-compile that file. (https://docs.onion.io/omega2-docs/cross-compiling.html)



  • Hi Maximilian:
    I have modified the repositories and installed GCC. I have re-run pip install pyaudio and the following error appears.
    Can you help me?
    Thanks

    Collecting pyaudio
    Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a 6b/PyAudio-0.2.11.tar.gz
    Building wheels for collected packages: pyaudio
    Running setup.py bdist_wheel for pyaudio ... error
    Failed building wheel for pyaudio
    Running setup.py clean for pyaudio
    Failed to build pyaudio
    Installing collected packages: pyaudio
    Running setup.py install for pyaudio ... error
    Command "/usr/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-install-vnIsuA/pyaudio/setup.py';f=ge tattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exe c'))" install --record /tmp/pip-record-oDrbi4/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-vnIsuA/pyaudio/



  • Hello, now when I execute python setup.py install I have this error:
    Puff... thanks to everyone

    *running install
    running bdist_egg
    running egg_info
    writing src/PyAudio.egg-info/PKG-INFO
    writing top-level names to src/PyAudio.egg-info/top_level.txt
    writing dependency_links to src/PyAudio.egg-info/dependency_links.txt
    reading manifest file 'src/PyAudio.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'src/PyAudio.egg-info/SOURCES.txt'
    installing library code to build/bdist.linux-mips/egg
    running install_lib
    running build_py
    warning: build_py: byte-compiling is disabled, skipping.

    running build_ext
    building '_portaudio' extension
    mipsel-openwrt-linux-musl-gcc -fno-strict-aliasing -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mno-mips16 -mno-interlink-mips16 -iremap /root/source/build_dir/target-mipsel_24kc_musl-1.1.16/Python-2.7.14:Python-2.7.14 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -DNDEBUG -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mno-mips16 -mno-interlink-mips16 -iremap /root/source/build_dir/target-mipsel_24kc_musl-1.1.16/Python-2.7.14:Python-2.7.14 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-mips-2.7/src/_portaudiomodule.o
    src/_portaudiomodule.c:28:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'mipsel-openwrt-linux-musl-gcc' failed with exit status 1*



  • @JESUS-MARTINEZ said in Pyaudio library .Install.:

    src/_portaudiomodule.c:28:20: fatal error: Python.h: No such file or directory

    It needs the python development header files. I don't know if they are available to be installed on the Omega2 directly..

    Could you try opkg update && opkg install python-dev please. Or directly the python-dev_2.7.14-5_mipsel_24kc.ipk file from http://repo.onion.io/omega2/packages/packages/. (wget .. && opkg install ...)



  • I have installed:
    python - 2.7.14-5
    python-base - 2.7.14-5
    python-codecs - 2.7.14-5
    python-compiler - 2.7.14-5
    python-ctypes - 2.7.14-5
    python-db - 2.7.14-5
    python-decimal - 2.7.14-5
    python-dev - 2.7.14-5
    python-distutils - 2.7.14-5
    python-email - 2.7.14-5
    python-gdbm - 2.7.14-5
    python-lib2to3 - 2.7.14-5
    python-light - 2.7.14-5
    python-logging - 2.7.14-5
    python-multiprocessing - 2.7.14-5
    python-ncurses - 2.7.14-5
    python-openssl - 2.7.14-5
    python-pip - 8.1.2-1
    python-pydoc - 2.7.14-5
    python-pyserial - 3.1.1-1
    python-setuptools - 27.2.0-1
    python-sqlite3 - 2.7.14-5
    python-unittest - 2.7.14-5
    python-xml - 2.7.14-5

    When execute python setup.py install:
    Thanks

    running build_ext
    building '_portaudio' extension
    mipsel-openwrt-linux-musl-gcc -fno-strict-aliasing -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mno-mips16 -mno-interlink-mips16 -iremap /root/source/build_dir/target-mipsel_24kc_musl-1.1.16/Python-2.7.14:Python-2.7.14 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -DNDEBUG -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mno-mips16 -mno-interlink-mips16 -iremap /root/source/build_dir/target-mipsel_24kc_musl-1.1.16/Python-2.7.14:Python-2.7.14 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-mips-2.7/src/_portaudiomodule.o
    In file included from /usr/include/python2.7/Python.h:8:0,
    from src/_portaudiomodule.c:28:
    /usr/include/python2.7/pyconfig.h:1215:0: warning: "_XOPEN_SOURCE" redefined
    #define _XOPEN_SOURCE 600
    ^
    In file included from /usr/include/stdio.h:8:0,
    from src/_portaudiomodule.c:27:
    /usr/include/features.h:12:0: note: this is the location of the previous definition
    #define _XOPEN_SOURCE 700
    ^
    src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
    compilation terminated.
    error: command 'mipsel-openwrt-linux-musl-gcc' failed with exit status 1
    root@Omega-138B:/www/a/PyAudio-0.2.11#



  • Now it's missing the portaudio library (portaudio_19). The repo only seems to have the binaries (libportaudio.so.2) at http://repo.onion.io.s3.amazonaws.com/omega2/packages/packages/portaudio_19_20140130-1_mipsel_24kc.ipk but no development headers (i.e. portaudio.h).

    This is the part where you either (1) cross-compile from a virtual machine or (2) try something hacky.

    For (2):

    • opkg install portaudio_19 (or portaudio-19 if that fails)
    • download the header files, aka pa_stable_v190600_20161030.tgz from http://www.portaudio.com/download.html; extract the contents of the include/ folder (which contains the portaudio.h to /usr/include
    • make sure it's found by gcc on one of its -I flags, modify setup.py if needed

    Are you actually sure you want to use pyaudio which does OSS? Because I've been using ALSA in my project (which worked fine); So maybe https://github.com/larsimmisch/pyalsaaudio is the right package for you. But that one also requires you to compile one file which needs the ALSA development headers



  • Hello,I have installed PorAudio
    php7-mod-xml - 7.1.1-1
    portaudio - 19_20140130-1

    In file included from /usr/include/python2.7/Python.h:8:0,
    from src/_portaudiomodule.c:28:
    /usr/include/python2.7/pyconfig.h:1212:0: warning: "_XOPEN_SOURCE" redefined
    #define _XOPEN_SOURCE 600
    ^
    In file included from /usr/include/stdio.h:8:0,
    from src/_portaudiomodule.c:27:
    /usr/include/features.h:12:0: note: this is the location of the previous definition
    #define _XOPEN_SOURCE 700
    I copied portaudio.h to usr / include:
    New Error:
    Very Thanks for help me

    mipsel-openwrt-linux-musl-gcc -shared -L/root/source/staging_dir/target-mipsel_24kc_musl-1.1.16/usr/lib -L/root/source/staging_dir/target-mipsel_24kc_musl-1.1.16/lib -L/root/source/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/usr/lib -L/root/source/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/lib -znow -zrelro -L/root/source/build_dir/target-mipsel_24kc_musl-1.1.16/Python-2.7.14 build/temp.linux-mips-2.7/src/_portaudiomodule.o -L/usr/lib -lportaudio -lpython2.7 -o build/lib.linux-mips-2.7/_portaudio.so
    /usr/bin/ld: cannot find -lportaudio
    collect2: error: ld returned 1 exit status
    error: command 'mipsel-openwrt-linux-musl-gcc' failed with exit status 1
    root@Omega-138B:/www/a/PyAudio-0.2.11#

    I want to use ibm watson with python and this library requires me. PyAudio

    I really need a method that allows me to pick up the speech to text and I was going to use its API.
    Do you know any other method to collect voice to text in real time?



  • @JESUS-MARTINEZ said in Pyaudio library .Install.:

    /usr/bin/ld: cannot find -lportaudio

    Well, getting closer.

    Is libportaudio.so.* inside /usr/lib? If not copy it there. It should be somewhere on the system given that you've installed portaudio. Do a find / -name "libport*" if needed to find it.



  • Yes its installed.How repair library Maximilian?
    /usr/bin/ld: cannot find -lportaudio????

    root@Omega-138B:/www/a/PyAudio-0.2.11# find / -name "libport*"
    /overlay/upper/usr/lib/libportaudio.so.2
    /overlay/upper/usr/lib/libportaudio.so.2.0.0
    /usr/lib/libportaudio.so.2
    /usr/lib/libportaudio.so.2.0.0
    root@Omega-138B:/www/a/PyAudio-0.2.11#

    mipsel-openwrt-linux-musl-gcc -shared -L/root/source/staging_dir/target-mipsel_24kc_musl-1.1.16/usr/lib -L/root/source/staging_dir/target-mipsel_24kc_musl-1.1.16/lib -L/root/source/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/usr/lib -L/root/source/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/lib -znow -zrelro -L/root/source/build_dir/target-mipsel_24kc_musl-1.1.16/Python-2.7.14 build/temp.linux-mips-2.7/src/_portaudiomodule.o -L/usr/lib -lportaudio -lpython2.7 -o build/lib.linux-mips-2.7/_portaudio.so
    /usr/bin/ld: cannot find -lportaudio
    collect2: error: ld returned 1 exit status
    error: command 'mipsel-openwrt-linux-musl-gcc' failed with exit status 1



  • Execute the following command: ln -s /usr/lib/libportaudio.so.2 /usr/lib/libportaudio.so and retry. (Creates a symlink from /usr/lib/libportaudio.so -> /usr/lib/libportaudio.so.2)



  • hello,
    seems to install maximilian but when I want to use it, the following error appears
    Expression 'ioctl( devHandle, SNDCTL_DSP_SPEED, &sr )' failed in 'src/hostapi/oss/pa_unix_oss.c', line: 421
    Any ideas
    Many thanks ;)



  • What example code are you running and which sound card do you have installed? (I2S or some USB card?)


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.