9

I'm getting this error when trying to install PyAudio:

ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects

Does anyone know why this is happening and how to solve?

Best

Lakeside52
  • 159
  • 1
  • 2
  • 7
  • always put FULL error message (starting at word "Traceback") in question (not in comments) as text (not screenshot, not link to external portal). There are other useful information in the full error/traceback. – furas Aug 07 '22 at 20:25
  • when you run `pip` then you may use option `-v` (like `verbose`) to see more information when `pip` displays error. Without FULL error it is hard to say what is the problem. As I know `PyAudio` may use some C/C++ code and it may have problem with compilation. It may need to use `homebrew` in install some C/C++ libraries or C/C++ source codes with files `.h`. But all this need more information about error. OR you should check other question for this problem with `PyAudio` – furas Aug 07 '22 at 20:28
  • Hi @furas thanks for your reply - I have included the full message below – Lakeside52 Aug 07 '22 at 20:56
  • Acredito que esse link pode lhe ajudar [PyAudio](https://stackoverflow.com/questions/48690984/portaudio-h-no-such-file-or-directory) – Pedro Henrique Aug 10 '22 at 20:10
  • @penguin-dev 's solution in the comments below solved my issue, in case this is something you still haven't figured out. – S. Argentina Nov 05 '22 at 05:32
  • Does this answer your question? [Unable to install PyAudio on M1 Mac \[PortAudio already installed\]](https://stackoverflow.com/questions/68251169/unable-to-install-pyaudio-on-m1-mac-portaudio-already-installed) – Multihunter Dec 09 '22 at 00:43

4 Answers4

31

Try this solution:

These steps worked on M1 Pro chips

  1. Install portaudio
brew install portaudio
  1. Link portaudio
brew link portaudio
  1. Copy the path where portaudio was installed (use it in the next step)
brew --prefix portaudio
  1. Create .pydistutils.cfg in your home directory
sudo nano $HOME/.pydistutils.cfg

then paste the following

[build_ext]
include_dirs=<PATH FROM STEP 3>/include/
library_dirs=<PATH FROM STEP 3>/lib/

  1. Install pyaudio
pip install pyaudio

or

pip3 install pyaudio

from: Unable to install PyAudio on M1 Mac [PortAudio already installed]

Zim
  • 410
  • 4
  • 13
Penguin Dev
  • 311
  • 2
  • 3
22

Developments files are needed. Those files are installed with the portaudio19-dev package.

sudo apt install portaudio19-dev
MUY Belgium
  • 2,330
  • 4
  • 30
  • 46
DanDaHahn
  • 221
  • 3
0

I had this error building my own package and it was fixed by ending the pip install statement with --user

Teddy_Tort
  • 87
  • 2
  • 10
0

you can use below line for Mac OS

$ python3 -m venv tensorflow-metal-test
$ source tensorflow-metal-test/bin/activate
$ cd tensorflow-metal-test/
$ python -m pip install -U pip
$ pip install tensorflow-macos
$ pip install tensorflow-metal
Mohamed Hussien
  • 1,084
  • 13
  • 14