Installation

System Dependencies

Linux (Ubuntu/Debian):

sudo apt install libsndfile1

Linux (Fedora/CentOS):

sudo dnf install libsndfile

macOS:

brew install libsndfile

Quick Install

To install fairseq2, simply run:

pip install fairseq2

To install fairseq2 with a specific PyTorch version (e.g. PyTorch 2.8.0 and CUDA 12.8):

pip install fairseq2\
  --extra-index-url https://fair.pkg.atmeta.com/fairseq2/whl/pt2.8.0/cu128

To install fairseq2 with additional extras (e.g. arrow) and a specific commit hash:

pip install 'fairseq2[arrow] @ git+https://github.com/facebookresearch/fairseq2.git@<commit-hash>'\
  --extra-index-url https://fair.pkg.atmeta.com/fairseq2/whl/pt2.8.0/cu128

For nightly builds:

pip install fairseq2 --pre\
  --extra-index-url https://fair.pkg.atmeta.com/fairseq2/whl/nightly/pt2.8.0/cu128

For an editable development installation:

git clone https://github.com/facebookresearch/fairseq2.git
cd fairseq2
pip install -e . --extra-index-url https://fair.pkg.atmeta.com/fairseq2/whl/pt2.8.0/cu128
pip install -r requirements-devel.txt

Supported Variants

Replace pt2.8.0/cu128 in the commands above with your desired combination: Linux:

Supported PyTorch Versions and CUDA Variants (Linux)

PyTorch Version

Variants

2.8.0

pt2.8.0/cpu, pt2.8.0/cu126, pt2.8.0/cu128

2.7.1

pt2.7.1/cpu, pt2.7.1/cu126, pt2.7.1/cu128

2.6.0

pt2.6.0/cpu, pt2.6.0/cu124

macOS (Apple Silicon):

Supported PyTorch Versions (macOS Apple Silicon)

PyTorch Version

Variants

2.8.0

pt2.8.0/cpu

2.7.1

pt2.7.1/cpu

Windows

fairseq2 does not support Windows natively. Use Windows Subsystem for Linux (WSL) and follow the Linux installation instructions.

Warning

fairseq2 relies on the C++ API of PyTorch which has no API/ABI compatibility between releases. This means you have to install the fairseq2 variant that exactly matches your PyTorch version. Otherwise, you might experience issues like immediate process crashes or spurious segfaults. For the same reason, if you upgrade your PyTorch version, you must also upgrade your fairseq2 installation.

Advanced Installation