yadeveloper1911
yadeveloper1911

Reputation: 1

Pyaudio is not recognized by python, what to do?

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.

Upvotes: 0

Views: 166

Answers (1)

saad_saeed
saad_saeed

Reputation: 193

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

Upvotes: 0

Related Questions