pyaudio could not import _portaudio

Related searches

Trying to run python app that uses pyaudio. Using virtualenv and installations are working. However when running it can't find portaudio. But the _portaudio.so file exists. Any suggestions???

(venv) kidkic@pi-mirror1:~/audio $ jasper/jasper.py 
Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
  File "jasper/jasper.py", line 31, in <module>
    from client.mic import Mic
  File "/home/kidkic/audio/jasper/client/mic.py", line 9, in <module>
    import pyaudio
  File "/home/kidkic/audio/venv/local/lib/python2.7/site-packages/pyaudio.py", line 116, in <module>
    import _portaudio as pa
ImportError: /home/kidkic/audio/venv/local/lib/python2.7/site-packages/_portaudio.so: undefined symbol: Pa_GetStreamReadAvailable


# CHECKING THAT THE FILE EXISTS (a binary file)
(venv) kidkic@pi-mirror1:~/audio $ ls venv/local/lib/python2.7/site-packages/_*
venv/local/lib/python2.7/site-packages/_portaudio.so

I can't import pyaudio?, Follow Step 3 in the link (pyaudio could not import _portaudio):. Open Terminal in the directory. Run the following command line one by one. What you need to do: Uninstall python-pyaudio with sudo apt-get purge --remove python-pyaudio if you have it (This is version 0.2.8) Download the latest version (19) of PortAudio. Untar and install PortAudio ./configure make make install Get the dependencies for pyaudio portaudio19-dev python-all-dev sudo pip install pyaudio After that, I was able to use pyaudio.

Pyaudio/portaudio package mismatch on Windows x64 � Issue #4 , pyd Could not import the PyAudio C module '_portaudio'. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Miniconda3-� Trying to run python app that uses pyaudio. Using virtualenv and installations are working. However when running it can't find portaudio. But the _portaudio.so file exists. Any suggestions??? (venv) kidkic@pi-mirror1:~/audio $ jasper/jasper.py Could not import the PyAudio C module '_portaudio'.

This worked for me

conda install -c anaconda portaudio

import _portaudio error � Issue #137 � scottlawsonbc/audio-reactive , Could not import the PyAudio C module '_portaudio'. Traceback (most recent call last): File "C:\Users\John\Desktop\visualization.py", line 7, in Could not import the PyAudio C module '_portaudio'. Traceback (most recent call last): File "C:\Users\John\Desktop\visualization.py", line 7, in. import microphone. File "C:\Users\John\Desktop\microphone.py", line 3, in. import pyaudio. File "C:\Users\John\Desktop\pyaudio.py", line 116, in. import _portaudio as pa.

Pip unistall pyaudio Pipwin install pyaudio For windows machine

I filed this issue previously at pyaudio-feedstock. Short summary: portaudio provided by conda-forge does not work for me on Windows (ImportError) and I can also not use it to build pyaudio (so far) due to missing headers.

Could not import the PyAudio C module '_portaudio'. Traceback (most recent call last): File "<ipython-input-1-2b39d94ceb5b>", line 1, in <module> runfile('/home/sanwal092/Desktop/Python/SR/dummy.py', wdir='/home/sanwal092/Desktop/Python/SR') File "/home/sanwal092/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 866, in runfile execfile(filename, namespace) File "/home/sanwal092/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102

sudo apt-get install libportaudio-dev (first try with this) sudo apt-get install portaudio19-dev (instead use this) later install pyaudio (python -m pip install PyAudio)

I have a Windows 10 PC and I want to install pyaudio to use it with my chatbot, powered by chatterbot. I tried 2 different ways to install pyaudio. The first way is doing this on the command prompt: python -m pip install PyAudio This is the result:

Comments
  • Thanks, Tried your suggestion sudo apt-get purge --remove python-pyaudio sudo apt-get autoremove pip uninstall pyaudio wget http://www.portaudio.com/archives/pa_stable_v19_20140130.tgz tar -xf pa_stable_v19_20140130.tgz cd portaudio/ ./configure make clean make sudo make install sudo apt-get install portaudio19-dev python-all-dev pip install pyaudio (Successfully installed pyaudio-0.2.9) Now getting `Could not import the PyAudio C module '_portaudio'.
  • Is there more to that error? e.g. your previous error said that as well, but went on to say "undefined symbol: Pa_GetStreamReadAvailable"
  • Nope: The new error Could not import the PyAudio C module '_portaudio'. Traceback (most recent call last): File "jasper/jasper.py", line 31, in <module> from client.mic import Mic File "/home/kidkic/audio/jasper/client/mic.py", line 9, in <module> import pyaudio File "/home/kidkic/audio/venv/local/lib/python2.7/site-packages/pyaudio.py", line 116, in <module> import _portaudio as pa ImportError: libportaudio.so.0: cannot open shared object file: No such file or directory The file /home/kidkic/audio/venv/local/lib/python2.7/site-packages/_portaudio.so exists.
  • The error now is that it can't find the libportaudio.so.0 file. I don't have access to my pi right now to see where mine is, but a couple thoughts: Do you have LD_LIBRARY_PATH set to include /usr/local/lib? And did you use sudo with "pip install pyaudio", so pip can install into whatever directories it wants to put the libraries?
  • I have LD_LIBRARY_PATH and LD_RUN_PATH in .bashrc . I deactivated virtualenv and installed pip modules and now it works. Seemed to be something weird when using python virtualenv and portaudio maybe, or I'm just doing stuff wrong. thx for the help
  • Can you explain more what you did and why?