Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install pyaudio on mac using Python 3?

People also ask

Does Python 3.7 support PyAudio?

pyaudio is not supported with python 3.7.

How do I install PyAudio in Pydroid 3?

Install the module By Pip install pyaudio In the terminal tab Or use qpython 3l There go to pip console But the command is Pip3 install pyaudio.

Which version of Python is suitable for PyAudio?

If you want to use PyAudio , it is best to download python version 3.6.


I'm assuming you are on a Mac. This is a simple issue to fix.

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

So to clarify, Xcode is installed through the App Store. Xcode command line tools are required for some installations, for others they are not. I'm including it here just to be on the safe side. You also probably do not need to uninstall and reinstall the formula via Homebrew, I did that to ensure that there would be absolutely no problems.

Edit: I have been told Homebrew requires Xcode. So just run the

xcode-select --install

command to be able to use Clang. Also what version of Mac are you on?


Steps: I assume you are using a mac osx

  1. download homebrew by pasting this code at any terminal point /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  2. After installing homebrew, install portaudio: brew install portaudio

  3. Finally install pyaudio using pip pip install pyaudio

Note: Ensure you install homebrew if its not already installed


Steps: I assume you are using a mac osx

download homebrew by pasting this code at any terminal point /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After installing homebrew, install portaudio: brew install portaudio

Finally install pyaudio using pip pip install pyaudio


Open the Terminal(located in the utilities folder in Applications) and follow the instructions:

With homebrew:

brew install portaudio
pip install pyaudio

Without homebrew:

cd Downloads
curl http://files.portaudio.com/archives/pa_stable_candidate_v190700_rc2_20210331.tgz
tar -xzf pa_stable_candidate_v190700_rc2_20210331.tgz
cd portaudio

pip3 install pyaudio --global-option="build_ext" --global-option="-I$(pwd)/include" --global-option="-L$(pwd)/lib"

In case of MacOS

brew install portaudio

pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio

Working with Homebrew failed for me on a Macbook Pro M1.

Instead, I installed portaudio from source http://files.portaudio.com/docs/v19-doxydocs/tutorial_start.html

and used

./configure && make
sudo make install
sudo cp include/pa_mac_os.h /usr/local/include

Obviously, there is a bug in the portaudio package for Mac M1, so I had to add the hack of the copy of the include file.

But then

python3 -m pip install pyaudio

and it worked.