Install & Compatibility
Where this runs
tested against v2.11.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 20.5s · import 0.772s · 28MB
1331MB installed
● package 1331MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
torchaudio
✓ import torchaudio
✗ import torchaudio
This quickstart demonstrates how to import TorchAudio, create a dummy audio waveform, and apply a common audio transformation like MelSpectrogram. In practice, `torchaudio.load` is used to load actual audio files.
import torch
import torchaudio
from torchaudio import transforms
# Create a dummy waveform (1 channel, 16000 samples at 16kHz)
# In a real scenario, you would load an audio file: waveform, sample_rate = torchaudio.load("path/to/audio.wav")
waveform = torch.randn(1, 16000)
sample_rate = 16000
# Define a MelSpectrogram transform
melspectrogram_transform = transforms.MelSpectrogram(sample_rate=sample_rate, n_mels=128)
# Apply the transform
melspectrogram = melspectrogram_transform(waveform)
print(f"Waveform shape: {waveform.shape}")
print(f"MelSpectrogram shape: {melspectrogram.shape}")
# Expected output:
# Waveform shape: torch.Size([1, 16000])
# MelSpectrogram shape: torch.Size([1, 128, X]) where X depends on n_fft and hop_length
Debug
Known issues
breakingBreaking API changes: Most APIs explicitly marked as 'drop' were deprecated in TorchAudio 2.8 and subsequently removed in 2.9. This can cause `AttributeError` or `ImportError` if upgrading from older versions.fixRefer to the TorchAudio 2.9 migration guide on the official documentation to identify and update removed APIs. Many functions were consolidated or moved to `torchcodec`.
affects: >=2.9.0
gotchaThe `torchaudio.load()` and `torchaudio.save()` functions (since 2.9) now internally rely on the `torchcodec` library. While they maintain a compatible API, some parameters like `normalize`, `buffer_size`, and `backend` are ignored. For optimal performance and full control, it is recommended to directly use `torchcodec.decoders.AudioDecoder` and `torchcodec.encoders.AudioEncoder`.fixReview calls to `torchaudio.load()` and `torchaudio.save()`. Migrate to native `torchcodec` APIs if you rely on parameters that are now ignored or for improved performance. Ensure `torchcodec` is installed and compatible with your `torch` version.
affects: >=2.9.0
breakingStrict PyTorch Version Compatibility: TorchAudio releases are tightly coupled with specific PyTorch versions. Using mismatched versions of `torch` and `torchaudio` will lead to runtime errors, particularly with C++ extensions.fixAlways install `torch` and `torchaudio` versions that are explicitly listed as compatible in the official TorchAudio compatibility matrix (e.g., `torch==X.Y.Z` and `torchaudio==X.Y.Z`).
affects: All versions
gotchaFFmpeg dependency for I/O: TorchAudio's audio loading and saving functionalities, particularly through the `torchcodec` backend, heavily rely on FFmpeg being installed and accessible on your system. Missing or incompatible FFmpeg versions can lead to `RuntimeError` during audio processing.fixEnsure FFmpeg is installed and discoverable by your system. For `conda` environments, `conda install -c conda-forge 'ffmpeg<8'` (or a suitable version) is often effective. Refer to `torchcodec` installation instructions for detailed FFmpeg compatibility.
affects: All versions, especially >=2.9.0
breakingIncompatibility with new Python versions: `torchaudio` releases often lag behind new Python versions. Attempting to install `torchaudio` on a freshly released or unsupported Python version (e.g., Python 3.13 during its early release cycle) will result in `No matching distribution found` errors, as pre-built wheels may not be available.fixEnsure your Python environment uses a version explicitly supported by the specific `torch` and `torchaudio` release you intend to use. Consult the official PyTorch and TorchAudio compatibility matrix for compatible Python versions.
affects: All versions
Upgrade
Version history
2.11.0latest on PyPI · released Mar 23, 2026
Audit
Dependencies
torchrequiredTorchAudio is built on PyTorch and requires a compatible version.
ffmpegoptionalRequired for `torchaudio.io` module and the underlying TorchCodec for audio loading/saving. Installation via conda or system package manager is recommended.
sentencepieceoptionalRequired for Automatic Speech Recognition with Emformer RNN-T.
deep-phonemizeroptionalRequired for Text-to-Speech with Tacotron2.