Monday 30 December 2013

OS X Mavericks Pil/Pillow zipconf.h not found.

TL;DR

I use Homebrew python and after running the command line xcode-select --install command Pil/Pillow was completely borked. I fixed it by re-installing my homebrew Python.

Solving it

Out of the box PNG support for Pil/Pillow seems to be non-existent and twice I’ve attempted the solutions proposed on Stackoverflow here and here and both times I’ve ended up completely borking my ability to install and compile Pil/Pillow; behold thy bork –

## snipped much code
In file included from decode.c:720:
/usr/local/include/Zip.h:53:10: fatal error: 'zipconf.h' file not found
#include 
         ^
1 error generated.
error: command 'cc' failed with exit status 1

To solve this the first time around I re-installed my entire operating system ( overkill I know ) after many wasted hours of searching for variations on “OSX Maverick Pil zipconf.h error”.

Chief Suspect

I retraced my steps in the command line and after running this command ( which installed the xcode command line tools ) I got the dreaded error.

xcode-select --install

I’d love to have something clever to say about what happened, but I don’t.

Re-install homebrew python

I was using homebrew’s python … so I installed all the possible requirements I could need for png support and then remove and reinstalled python –

# all the things
brew install libtiff libjpeg libpng webp littlecms
# remove and rebuild python
brew remove python
brew install python
brew link python

I created new virtualenv and tried to install pill and it worked. I did however, have to nuke my old virtualenvs, but that’s cool. After wasted hours I was able to see this joyous sight –

    --------------------------------------------------------------------
    --- TKINTER support available
    --- JPEG support available
    --- ZLIB (PNG/ZIP) support available
    --- TIFF G3/G4 (experimental) support available
    --- FREETYPE2 support available
    --- LITTLECMS support available
    --- WEBP support available
    --- WEBPMUX support available
    --------------------------------------------------------------------
    To check the build, run the selftest.py script.

    changing mode of build/scripts-2.7/pilconvert.py from 644 to 755
    changing mode of build/scripts-2.7/pildriver.py from 644 to 755
    changing mode of build/scripts-2.7/pilfile.py from 644 to 755
    changing mode of build/scripts-2.7/pilfont.py from 644 to 755
    changing mode of build/scripts-2.7/pilprint.py from 644 to 755
    changing mode of /Users/jcurle/.virtualenvs/houasdasdsa/bin/pilconvert.py to 755
    changing mode of /Users/jcurle/.virtualenvs/houasdasdsa/bin/pildriver.py to 755
    changing mode of /Users/jcurle/.virtualenvs/houasdasdsa/bin/pilfile.py to 755
    changing mode of /Users/jcurle/.virtualenvs/houasdasdsa/bin/pilfont.py to 755
    changing mode of /Users/jcurle/.virtualenvs/houasdasdsa/bin/pilprint.py to 755
Successfully installed pillow