I am installing different python libraries for my voice assistant project. I installed "speechrecognization" but I am not able to add pyaudio.
I got an error stating that
ERROR: Failed building wheel for PyAudio", Collecting PyAudio
Using cached PyAudio-0.2.13.tar.gz (46 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: PyAudio
Building wheel for PyAudio (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for PyAudio (pyproject.toml) did not run successfully.
│ exit code: 1
and
Could not build wheels for PyAudio, which is required to install pyproject.toml-based projects
I tried upgrading pip
pip install --upgrade pip
also,
sudo apt install build-essential portaudio19-dev python3.10-dev
pip install pyaudio
brew install portaudio
brew link --overwrite portaudio
pip install pyaudio
python -m pip install PyAudio
pip install PyAudio --upgrade
OS: Mac M1 chip Python 3.10.2
CodePudding user response:
I tried installing PyAudio using Homebrew and it worked use the following command:
brew install portaudio
pip install pyaudio
This will first install the portaudio library using Homebrew, and then use pip to install PyAudio, which is a Python wrapper for portaudio.
CodePudding user response:
From the PyAudio project page; "PyAudio provides Python bindings for PortAudio v19, the cross-platform audio I/O library. With PyAudio, you can easily use Python to play and record audio on a variety of platforms, such as GNU/Linux, Microsoft Windows, and Apple macOS." https://people.csail.mit.edu/hubert/pyaudio/
The project page does in fact state that this python module creates bindings to the PortAudio api. The author lists the steps necessary to install on macOS as being 1) use homebrew to install PortAudio 2) use pip to install PyAudio module. I was able to verify personally that these steps work as of MacOS 13.0.1 on Intel based macbook pro.
*Installing Homebrew via terminal; /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
*Then installing PortAudio via brew; brew install portaudio
*and finally; pip3 install pyaudio