CompressAI supports python 3.6+ and PyTorch 1.7+.

From PyPI#

This is the recommended method to get started.

pip install compressai

From source#

We recommend to use a virtual environment to isolate project packages from the base system installation.


  • pip 19.0 or later

  • a C++17 compiler (tested with gcc and clang)

  • python packages: numpy, scipy, torch, torchvision

Virtual environment#

python3 -m venv venv
source ./venv/bin/activate
pip install -U pip

Using pip#

  1. Clone the CompressAI repository:

git clone compressai
  1. Install CompressAI:

cd compressai
pip install -e .
  1. Custom installation

You can also run one of the following commands:

  • pip install -e '.[dev]': install the packages required for development (testing, linting, docs)

  • pip install -e '.[tutorials]': install the packages required for the tutorials (notebooks)

  • pip install -e '.[all]': install all the optional packages

Build your own package#

You can also build your own pip package:

git clone compressai
cd compressai
python3 bdist_wheel --dist-dir dist/
pip install dist/compressai-*.whl


on MacOS you might want to use CC=clang CXX=clang++ pip install ... to compile with clang instead of gcc.


We are planning to publish docker images in the future.

For now, a Makefile is provided to build docker images locally. Run make help in the source code directory to list the available options.