Solvedspeech_recognition Install/compilation of PyAudio failed
✔️Accepted Answer
Tried those apt commands ( I left our libportaudio2 as apt informed me it was already installed)
$ sudo apt install libasound-dev portaudio19-dev libportaudiocpp0
which resulted in
The following NEW packages will be installed:
libasound2-dev libjack-dev libjack0 libportaudiocpp0 portaudio19-dev uuid-dev
Back to the VE, and although building the wheel fails, installed PyAudio
$ pip3 install pyaudio
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz
Building wheels for collected packages: pyaudio
Running setup.py bdist_wheel for pyaudio ... error
Complete output from command .../SpeechRecognition/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-7egcf6_n/pyaudio/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 /tmp/tmps83qs996pip-wheel- --python-tag cp36:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --helperror: invalid command 'bdist_wheel'
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 ... done
Successfully installed pyaudio-0.2.11
Try the SpeechRecognition again
$ python3 -m speech_recognition
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
A moment of silence, please...
Set minimum energy threshold to 366.5422636248088
Say something!
Got it! Now to recognize it...
You said no no
Say something!
^C
Seems to fix it. The readme at https://github.com/Uberi/speech_recognition/blob/master/README.rst needs updating to reflect the additional packages required (if PyAudio is to be used)
Other Answers:
I got the same error, and I found that the file "portaudio.h" was truly missing. So i first usebrew install portaudio
and then pip install pyaudio
. These work for me. If those commands still not work ,maybe this may help.
Kubuntu 17.10.1
Python 3.6.3
Pip 9.0.1
Created a virtual environment and read through the SpeechRecognition instructions. Here are the steps
$ sudo apt-get install python-pyaudio python3-pyaudio
that went okay, it also installed libportaudio2
$ sudo apt-get install python3 python3-all-dev python3-pip build-essential swig git libpulse-dev
Apt also added the suggestions - "The following NEW packages will be installed:
libglib2.0-dev libglib2.0-dev-bin libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpulse-dev libpython3-all-dev pkg-config python3-all python3-all-dev swig swig3.0"
Then installed SpeechRecognition
$ pip install SpeechRecognition
Then tried SpeechRecognition and got an error
Tried installing PyAudio , even though it is already installed via Apt
This appears to be the same problem - SlapBot/stephanie-va#8 . I will try the solution at SlapBot/stephanie-va#8 (comment)
Not sure if the following had an impact or not. The apt commands I used were run within a virtual environment, but I would have thought anything to do with Kubuntu packages would be system wide. I installed SpeechRecognition with
pip
instead ofpip3
(I don't think it matters).Although if I run pip3 or pip within the virtual environment, they both say version 9.0.1, yet if I run them both outside the virtual environment, it shows pip3 is installed but not pip.