Pyaudio is not recognized by python, what to do?

168 Views Asked by At
Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\speech_recognition\__init__.py", line 108, in get_pyaudio
    import pyaudio
  File "C:\Python39\lib\site-packages\pyaudio.py", line 116, in <module>
    import _portaudio as pa
ModuleNotFoundError: No module named '_portaudio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python39\yagmail.py", line 2, in <module>
    import yagmail
  File "C:\Python39\yagmail.py", line 5, in <module>
    with sr.Microphone() as source:
  File "C:\Python39\lib\site-packages\speech_recognition\__init__.py", line 79, in __init__
    self.pyaudio_module = self.get_pyaudio()
  File "C:\Python39\lib\site-packages\speech_recognition\__init__.py", line 110, in get_pyaudio
    raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation

I have installed Pyaudio for atleast a dozen times but it doesn`t work, my laptop is windows 10 64 bit, but why is port audio appeared in the error, I mean portaudio is related to mac, right? Why does it ask about portaudio? And also I have installed and uninstalled the pyaudio a dozen times at least. I installed it using pip, pipwin and what not.. and it's not only this one yagmail project, voice recognition and pyaudio related every project is showing the same error.

Please, help.

1

There are 1 best solutions below

0
On

Method 1:

First:

pip install pipwin

then:

pipwin install pyaudio

Method 2:

First:

sudo apt-get install portaudio19-dev

Then:

git clone https://people.csail.mit.edu/hubert/git/pyaudio.git

Then:

python setup.py install  //As you are on Windows