Skip to content

Instantly share code, notes, and snippets.

@soumith
Last active March 28, 2022 16:53
Show Gist options
  • Save soumith/01da3874bf014d8a8c53406c2b95d56b to your computer and use it in GitHub Desktop.
Save soumith/01da3874bf014d8a8c53406c2b95d56b to your computer and use it in GitHub Desktop.
Install PillowSIMD+libjpeg-turbo on Conda
conda uninstall --force pillow -y
# install libjpeg-turbo to $HOME/turbojpeg
git clone https://github.com/libjpeg-turbo/libjpeg-turbo
pushd libjpeg-turbo
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$HOME/turbojpeg
make
make install
popd
# install pillow-simd with jpeg-turbo support
git clone https://github.com/uploadcare/pillow-simd
pushd pillow-simd
CPATH=$HOME/turbojpeg/include LIBRARY_PATH=$HOME/turbojpeg/lib CC="cc -mavx2" python setup.py install
# add turbojpeg to LD_LIBRARY_PATH
export LD_LIBRARY_PATH="$HOME/turbojpeg/lib:$LD_LIBRARY_PATH"
@xvdp
Copy link

xvdp commented Mar 30, 2019

Thanks for the gist soumith
I wouldnt uninstall any packages - just create a fresh conda, the minute that you start uninstalling stuff youll break everything.
a quick note. for libjpeg-turbo you need an asm compiler
sudo apt-get install nasm

@catalys1
Copy link

I also had to install zlib:

sudo apt install zlib1g-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment