speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

pyaudio after installation not working

Open jaydeep-shingala opened this issue 4 years ago • 9 comments

I tried everything from pipwin to unofficial binary file installation and tried everything. still in cmd : import pyaudio is working but if i write import pyaudio in python IDLE it;s not working.............

please help

Originally posted by @jaydeep-shingala in https://github.com/Uberi/speech_recognition/issues/235#issuecomment-683681861

jaydeep-shingala avatar Aug 31 '20 09:08 jaydeep-shingala

@jaydeep-shingala can you please post error

mytja avatar Sep 18 '20 08:09 mytja

try:
     import pyaudio
except Exception as err:
     print(err)

#Write the above code when importing and if importing pyaudio doesn't work it will print the error in the cmd/terminal without tracebaking,then you can find the Problem why importing doesn't work. And if you can't solve please post the error.

TSSwork avatar Oct 22 '20 14:10 TSSwork

I already installed pyaudio when I again try to install it, it shows requirement already satisfied and its location .But when I run code in Pycharm ,it shows the following error: During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/vssnr/PycharmProjects/pythonProject/main.py", line 11, in message=a.listen(sr.Microphone()) File "C:\Users\vssnr\PycharmProjects\pythonProject\venv\lib\site-packages\speech_recognition_init_.py", line 79, in init self.pyaudio_module = self.get_pyaudio() File "C:\Users\vssnr\PycharmProjects\pythonProject\venv\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 Can anybody help me to resolve this. My python version is 3.8.6 (in pycharm) I have downloaded pyaudio file:(PyAudio-0.2.11-cp38-cp38-win_amd64) from unofficial python binaries and installed it in cmd and also imported to python 3.8 in the same

shadowrockzzz avatar Nov 08 '20 12:11 shadowrockzzz

can you send me your code to see what the error is

TSSwork avatar Nov 09 '20 06:11 TSSwork

when i try to install pyaudio using pip command in cmd, the following is shown:

C:\windows\system32>python Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

exit()

C:\windows\system32>pip install pyaudio Requirement already satisfied: pyaudio in c:\users\vssnr\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (0.2.11)

But when I use it in Pycharm it shows a module not found error. See the following code. My code in pycharm is:

import sys import speech_recognition as sr ver=sys.version print(ver) a=sr.Recognizer() message=a.listen(sr.Microphone()) print(message)

And the answer I got in the console is:

C:\Users\vssnr\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/vssnr/PycharmProjects/pythonProject/main.py Traceback (most recent call last): File "C:\Users\vssnr\PycharmProjects\pythonProject\venv\lib\site-packages\speech_recognition_init_.py", line 108, in get_pyaudio import pyaudio ModuleNotFoundError: No module named 'pyaudio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/vssnr/PycharmProjects/pythonProject/main.py", line 14, in message=a.listen(sr.Microphone()) File "C:\Users\vssnr\PycharmProjects\pythonProject\venv\lib\site-packages\speech_recognition_init_.py", line 79, in init self.pyaudio_module = self.get_pyaudio() File "C:\Users\vssnr\PycharmProjects\pythonProject\venv\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 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]

Process finished with exit code 1

Can U please tell me the mistake where I have done and Thank You in advance.

On Mon, Nov 9, 2020 at 11:34 AM Teshan Sachintha [email protected] wrote:

can you send me your code to see what the error is

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Uberi/speech_recognition/issues/508#issuecomment-723779926, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQT5YB3NAGX6LVT4D3TNGPDSO6BANANCNFSM4QQKO6WA .

shadowrockzzz avatar Nov 09 '20 07:11 shadowrockzzz

I have the same error on ubuntu 18.4

dittrichlucas avatar Jan 20 '21 23:01 dittrichlucas

If someone still having this issue after installing python3-pyaudio this is how I solved it:

  1. Execute this: sudo apt-get install portaudio19-dev python3-pyaudio
  2. Now install pyaudio through pip: pip install pyaudio
  3. Now you should be able to use pyaudio!

This is for linux, tested in popOS (should work in ubuntu and other linux distrubtions too)

Im-Fran avatar Apr 02 '21 17:04 Im-Fran

For windows pip install pipwin && pipwin install pyaudio

SmartManoj avatar Sep 05 '21 03:09 SmartManoj

venv

It's in venv. Try in sublime text

SmartManoj avatar Sep 05 '21 03:09 SmartManoj