Skip to content

Instantly share code, notes, and snippets.

@willprice
Created February 28, 2021 09:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save willprice/47ef743ca2ad3387e5e6baabe4f30fad to your computer and use it in GitHub Desktop.
Save willprice/47ef743ca2ad3387e5e6baabe4f30fad to your computer and use it in GitHub Desktop.
Pillow-SIMD with libjpeg/turbo
# The following steps are based on
# https://docs.fast.ai/performance.html#installation

$ conda install -y -c conda-forge gxx_linux-64 
$ conda uninstall -y --force jpeg libtiff
$ conda install -y -c conda-forge libjpeg-turbo --no-deps
$ pip uninstall -y pillow
$ export CXX=x86_64-conda-linux-gnu-g++
$ export CC=x86_64-conda-linux-gnu-gcc
$ CFLAGS="$CFLAGS -mavx2" pip install --upgrade --no-cache-dir --force-reinstall --no-binary :all: --compile pillow-simd

# Make sure Pillow doesn't get reinstalled
$ conda install -c conda-forge jpeg libtiff

Check that Pillow-SIMD is installed, it should have a .postX suffix on the version number:

$ python -c 'import PIL; print(PIL.__version__)'
7.0.0.post3

Check that Pillow-SIMD was built against libjpeg-turbo:

$ python -c 'import PIL.features; print(PIL.features.check_feature("libjpeg_turbo"))'
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment