Reputation: 135
Help me install the PyAudio library on MacOS (M1), I tried everything :(
My actions
brew reinstall portaudio
==> Downloading https://ghcr.io/v2/homebrew/core/portaudio/manifests/19.7.0-1 Already downloaded: /Users/code232/Library/Caches/Homebrew/downloads/2ba32ec74d5080567eae3412994e5c8bc39afcd1dacfe3a0d347d210e47c5f7e--portaudio-19.7.0-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/portaudio/blobs/sha256:8f390b Already downloaded: /Users/code232/Library/Caches/Homebrew/downloads/c1fa92f01d5c060c79bea1c294e230dc5a074a49c42f39b9bf68bffa6c79ea98--portaudio--19.7.0.arm64_monterey.bottle.1.tar.gz
==> Reinstalling portaudio
==> Pouring portaudio--19.7.0.arm64_monterey.bottle.1.tar.gz šŗ /opt/homebrew/Cellar/portaudio/19.7.0: 33 files, 543.2KB
==> Running brew cleanup portaudio
...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew
).
pip install pyaudio
Collecting pyaudio
Using cached PyAudio-0.2.12.tar.gz (42 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
ā°ā> [16 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-cpython-39
copying src/pyaudio.py -> build/lib.macosx-10.9-universal2-cpython-39
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-universal2-cpython-39
creating build/temp.macosx-10.9-universal2-cpython-39/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DMACOSX=1 -I/usr/local/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-universal2-cpython-39/src/_portaudiomodule.o
src/_portaudiomodule.c:31:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
Upvotes: 0
Views: 3702
Reputation: 90
How to install pyaudio on mac using Python 3?
First install Xcode. Then restart your computer. Afterwards run the commands in sequence,
xcode-select --install
brew remove portaudio
brew install portaudio
pip3 install pyaudio
Upvotes: 1