-
-
Save soumith/01da3874bf014d8a8c53406c2b95d56b to your computer and use it in GitHub Desktop.
| 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" |
@ivankreso, you probably want to reinstall libtiff after building pillow-simd, otherwise you may have some broken conda packages, since you removed their dependency. and while libjpeg-turbo replaces jpeg, the latter will still be re-installed by conda on the next update of any package relying on jpeg. So just as well, append to your suggestion:
conda install -y jpeg libtiff
Thanks to your input, I built a more complete version with quite a lot of prose explaining which is which here: https://docs.fast.ai/performance.html#faster-image-processing
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
I also had to install zlib:
sudo apt install zlib1g-dev
I couldn't do it without removing jpeg and libtiff packages.
Here is how I did it without messing with libpaths: