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

5

26

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

Hypoplasia answered 7/8, 2022 at 15:14 Comment(6)
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.Babiche
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 PyAudioBabiche
Hi @Babiche thanks for your reply - I have included the full message belowHypoplasia
Acredito que esse link pode lhe ajudar PyAudioKierkegaard
@penguin-dev 's solution in the comments below solved my issue, in case this is something you still haven't figured out.Dashtikavir
Does this answer your question? Unable to install PyAudio on M1 Mac [PortAudio already installed]Amphicoelous
D
66

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]

Disarming answered 10/8, 2022 at 20:8 Comment(9)
Answer the question in text not as a screenshotTrophic
This helped fix my pyaudio install issues. Thank you! This works for M1 chip macOS issues.Dashtikavir
many thanks!! -- from a M1 userAultman
You are a genius! Repaired my issue on an M1 mac.Frayne
2018 mac intel works as well!Mongolism
For me, a mere brew install portaudio was enough in Intel MacRonnaronnholm
I hadn't seen heilala's comment, but I didn't use sudo in step 4 and my problem is resolved.Phoenician
for me the key was to use pip3 instead of pipPardoner
This worked for me for python 3.12 on Ubuntu (note that there is "3" in python3-all-dev): sudo apt-get install portaudio19-dev python3-all-dev and pip install pyaudioOrlene
B
43

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

sudo apt install portaudio19-dev
Ballman answered 5/9, 2022 at 13:24 Comment(5)
this also work on ubuntu 22! thanksWade
Worked on Ubuntu 23.04Supinate
Worked on Ubuntu 20.04, thank youOlathe
Also works in Debian 12Wehrmacht
Worked on Ubuntu 22.04.4 LTS.. Thank you.Arena
T
1

When I use docker to dockerize my flask application I recieved this error so I solved this problem with this command. I just paste this in my Dockerfile

apt-get update && apt-get install -y \
        libportaudio2 libportaudiocpp0 portaudio19-dev \
        python3-dev \
        build-essential \
        && rm -rf /var/lib/apt/lists/*
Tridentine answered 25/4 at 18:51 Comment(0)
S
0

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

Shadowgraph answered 16/9, 2022 at 16:28 Comment(0)
P
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
Panegyrize answered 7/6, 2023 at 15:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.