Uberi / speech_recognition

Speech recognition module for Python, supporting several engines and APIs, online and offline.
https://pypi.python.org/pypi/SpeechRecognition/
BSD 3-Clause "New" or "Revised" License
8.4k stars 2.4k forks source link

import errorpy audio #545

Open aritraghosh-dev opened 3 years ago

aritraghosh-dev commented 3 years ago

Steps to reproduce

File "/home/aritra/anaconda3/lib/python3.8/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 "pandaa.py", line 65, in query = takeCommand().lower() File "pandaa.py", line 37, in takeCommand with sr.Microphone() as source: File "/home/aritra/anaconda3/lib/python3.8/site-packages/speech_recognition/init.py", line 79, in init self.pyaudio_module = self.get_pyaudio() File "/home/aritra/anaconda3/lib/python3.8/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 `


SorkoPiko commented 3 years ago

same problem

isos:ai-testing isos$ python3 -m speech_recognition
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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 "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/speech_recognition/__main__.py", line 4, in <module>
    m = sr.Microphone()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/speech_recognition/__init__.py", line 79, in __init__
    self.pyaudio_module = self.get_pyaudio()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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

and when i do isos:ai-testing isos$ pip install pyaudio to install pyaudio i get

Collecting pyaudio
  Using cached PyAudio-0.2.11.tar.gz (37 kB)
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-install-913cuc86/pyaudio_6e6076bbc07b4856893a80299ceeb8f9/setup.py'"'"'; __file__='"'"'/private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-install-913cuc86/pyaudio_6e6076bbc07b4856893a80299ceeb8f9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-wheel-0r5jm4j7
       cwd: /private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-install-913cuc86/pyaudio_6e6076bbc07b4856893a80299ceeb8f9/
  Complete output (15 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.9
  copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.9
  running build_ext
  building '_portaudio' extension
  creating build/temp.macosx-10.9-x86_64-3.9
  creating build/temp.macosx-10.9-x86_64-3.9/src
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.9/src/_portaudiomodule.o
  xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
  Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
  See `man xcode-select` for more details.
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  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
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-install-913cuc86/pyaudio_6e6076bbc07b4856893a80299ceeb8f9/setup.py'"'"'; __file__='"'"'/private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-install-913cuc86/pyaudio_6e6076bbc07b4856893a80299ceeb8f9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-record-nl120x8z/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyaudio
         cwd: /private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-install-913cuc86/pyaudio_6e6076bbc07b4856893a80299ceeb8f9/
    Complete output (15 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.9
    copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.9
    running build_ext
    building '_portaudio' extension
    creating build/temp.macosx-10.9-x86_64-3.9
    creating build/temp.macosx-10.9-x86_64-3.9/src
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.9/src/_portaudiomodule.o
    xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
    Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
    See `man xcode-select` for more details.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-install-913cuc86/pyaudio_6e6076bbc07b4856893a80299ceeb8f9/setup.py'"'"'; __file__='"'"'/private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-install-913cuc86/pyaudio_6e6076bbc07b4856893a80299ceeb8f9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/2d/njj0m62n0ybgw25lpkgzjht40000gr/T/pip-record-nl120x8z/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyaudio Check the logs for full command output.

this is similar to what happened when i was installing face_recognition