How to Install PyAudio in Python
Cross-platform audio I/O with PortAudio
pip install PyAudio
What is PyAudio?
Cross-platform audio I/O with PortAudio
PyAudio PyAudio provides Python bindings for PortAudio v19, the cross-platform audio I/O library. With PyAudio, you can easily use Python to play and record audio on a variety of platforms, such as GNU/Linux, Microsoft Windows, and Apple macOS. PyAudio is distributed under the MIT License. Homepage API Documentation PyPi Installation See the INSTALLATION file in the source distribution for details. In summary, install PyAudio using on most platforms. Windows This installs the precompiled PyAudio library with PortAudio v19 19.7.0 included. The library is compiled with support for Windows MME API, DirectSound, WASAPI, and WDM-KS. It does not include support for ASIO. If you require support for APIs not included, you will need to compile PortAudio and PyAudio. macOS Use Homebrew to install the prerequisite portaudio library, then install PyAudio using : GNU/Linux Use the package manager to install PyAudio. For example, on Debian-based systems: Alternatively, if the latest version of PyAudio is not available, install it using . Be sure to first install development libraries for and . Building from source See the INSTALLATION file. Documentation & Usage Examples Read the API Documentation, or generate it from the source using . * Usage examples are in the directory of the source distribution, or see the project homepage. License PyAudio is distributed under the MIT License. See LICENSE.txt.
Quick Start
Minimal example to get started with PyAudio:
import pyaudio
print(pyaudio.__version__)
Installation
pip (standard)
pip install PyAudio
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install PyAudio
pip3
pip3 install PyAudio
conda
conda install -c conda-forge PyAudio
Poetry
poetry add PyAudio
Verify the Installation
After installing, confirm the package is available:
python -c "import pyaudio; print(pyaudio.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing PyAudio with pip.
ModuleNotFoundError: No module named 'pyaudio'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install PyAudio. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'pyaudio' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install PyAudio to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'pyaudio'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show PyAudio and upgrade with pip install --upgrade PyAudio.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install PyAudio. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user PyAudio
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org PyAudio
Recent Releases
| Version | Released |
|---|---|
0.2.14 latest |
2023-11-07 |
0.2.13 |
2022-12-26 |
0.2.12 |
2022-07-19 |
0.2.11 |
2017-03-19 |
0.2.10 |
2017-01-17 |
Manage PyAudio
Upgrade to latest version
pip install --upgrade PyAudio
Install a specific version
pip install PyAudio==0.2.14
Uninstall
pip uninstall PyAudio
Check what is installed
pip show PyAudio