uv: Failed to Build pyaudio
cc cmd not found when building pyaudio from source.
× Failed to build `pyaudio==0.2.14`
├─▶ The build backend returned an error
╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)
[stdout]
running bdist_wheel
running build
running build_py
copying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-312/pyaudio
running build_ext
building 'pyaudio._portaudio' extension
cc -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -fPIC -fPIC -I/usr/local/include -I/usr/include -I/home/.cache/uv/builds-v0/.tmp4odXqs/include
-I/home/.local/share/uv/python/cpython-3.12.8-linux-x86_64-gnu/include/python3.12 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-312/src/pyaudio/device_api.o
[stderr]
error: command 'cc' failed: No such file or directory
hint: This usually indicates a problem with the package or the build environment.
help: `pyaudio` (v0.2.14) was included because `realtimetts` (v0.1.0) depends on `pyaudio`
It seems pyaudio is unique and required portaudio.sh to be pulled in when build from source.
pip install --use-pep517 'pyaudio==0.2.14'
Collecting pyaudio==0.2.14
Downloading PyAudio-0.2.14.tar.gz (47 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
╰─> [14 lines of output]
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-312/pyaudio
copying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-312/pyaudio
running build_ext
building 'pyaudio._portaudio' extension
creating build/temp.linux-x86_64-cpython-312/src/pyaudio
cc -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -fPIC -fPIC -I/usr/local/include -I/usr/include -I/home/rune/code/packs/.venv/include -I/home/rune/.local/share/uv/python/cpython-3.12.8-linux-x86_64-gnu/include/python3.12 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-312/src/pyaudio/device_api.o
src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
9 | #include "portaudio.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/cc' 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: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyaudio)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (7 by maintainers)
@evanarlian What does
ccrefer to? With standard Python distributions, usuallygccis used, but for ours we useccwhich could point to a different compiler backend. You might get past the error by settingCC=gccAssuming this is on ubuntu, this looks like missing portaudio headers on the host system. Using @zanieb’s command on Ubuntu as an example, you would need the
portaudio19-devsystem package.e.g.
docker run -it ghcr.io/astral-sh/uv:bookworm /bin/bash -c "apt-get update && apt-get install -y python3-dev portaudio19-dev && uv venv && uv pip install pyaudio==0.2.14"should work.Related to
CCnot found, that likely meant you didn’t have any build tooling packages installed on your first attempt such asbuild-essential.The pyaudio/setup.py looks in
/usr/local/include,/usr/includefor these headers on linux. It does not bundle them as part of the package.