Robeezy
Robeezy

Reputation: 2464

Python PIL JPEG support works on Heroku but not locally

In order for me to get PIL JPEG support on Heroku I had to use a forked/edited version of PIL found here hg+https://bitbucket.org/etienned/pil-2009-raclette/#egg=PIL

It tells me JPEG support available for Heroku but on my local Ubuntu 12.04 I'm getting *** JPEG support not available.

Am I just missing some certain packages on my ubuntu machine? Here's the dump from installing using pip and requirements.txt

Heroku:

-----> Installing dependencies using Pip (1.3.1)

 ...

       Obtaining PIL from hg+https://bitbucket.org/etienned/pil-2009-raclette/#egg=PIL (from -r requirements.txt (line 48))
         Updating ./.heroku/src/pil clone
warning: bitbucket.org certificate with fingerprint 24:9c:45:8b:9c:aa:ba:55:4e:01:6d:58:ff:e4:28:7d:2a:14:ae:3b not verified (check hostfingerprints or web.cacerts config setting)
         Running setup.py egg_info for package PIL

       Installing collected packages: PIL
         Running setup.py develop for PIL

           --------------------------------------------------------------------
           PIL 1.2a0 SETUP SUMMARY
           --------------------------------------------------------------------
           version       1.2a0
           platform      Python 2.7.4 (default, Apr  6 2013, 22:14:13)
                         [GCC 4.4.3] on linux2
           --------------------------------------------------------------------
           *** TKINTER support not available
           --- JPEG support available
           *** WEBP support not available
           --- ZLIB (PNG/ZIP) support available
           --- FREETYPE2 support available
           --- LITTLECMS support available
           --------------------------------------------------------------------
           To add a missing option, make sure you have the required
           library, and set the corresponding ROOT variable in the
           setup.py script.

           To check the build, run the selftest.py script.
           Creating /app/.heroku/python/lib/python2.7/site-packages/PIL.egg-link (link to .)
           PIL 1.2a0 is already the active version in easy-install.pth
           Installing pilfile.py script to /app/.heroku/python/bin
           Installing pilfont.py script to /app/.heroku/python/bin
           Installing pilconvert.py script to /app/.heroku/python/bin
           Installing pilprint.py script to /app/.heroku/python/bin
           Installing pildriver.py script to /app/.heroku/python/bin

           Installed /app/.heroku/src/pil
       Successfully installed PIL

Local (Ubuntu):

(venv)robbie@ubuntu:~/git/myproject$ pip install -r requirements.txt 

...

Obtaining PIL from hg+https://bitbucket.org/etienned/pil-2009-raclette/#egg=PIL (from -r requirements.txt (line 48))
  Updating ./venv/src/pil clone
warning: bitbucket.org certificate with fingerprint 24:9c:45:8b:9c:aa:ba:55:4e:01:6d:58:ff:e4:28:7d:2a:14:ae:3b not verified (check hostfingerprints or web.cacerts config setting)
  Running setup.py egg_info for package PIL

Requirement already satisfied (use --upgrade to upgrade): static in ./venv/lib/python2.7/site-packages (from dj-static==0.0.5->-r requirements.txt (line 12))
Requirement already satisfied (use --upgrade to upgrade): tablib in ./venv/lib/python2.7/site-packages (from django-import-export==0.1.4->-r requirements.txt (line 20))
Requirement already satisfied (use --upgrade to upgrade): diff-match-patch in ./venv/lib/python2.7/site-packages (from django-import-export==0.1.4->-r requirements.txt (line 20))
Installing collected packages: PIL
  Running setup.py develop for PIL

    --------------------------------------------------------------------
    PIL 1.2a0 SETUP SUMMARY
    --------------------------------------------------------------------
    version       1.2a0
    platform      Python 2.7.3 (default, Apr 10 2013, 06:20:15)
                  [GCC 4.6.3] on linux2
    --------------------------------------------------------------------
    *** TKINTER support not available
    *** JPEG support not available
    *** WEBP support not available
    *** ZLIB (PNG/ZIP) support not available
    *** FREETYPE2 support not available
    *** LITTLECMS support not available
    --------------------------------------------------------------------
    To add a missing option, make sure you have the required
    library, and set the corresponding ROOT variable in the
    setup.py script.

    To check the build, run the selftest.py script.
    Creating /home/robbie/git/myproject/venv/lib/python2.7/site-packages/PIL.egg-link (link to .)
    Adding PIL 1.2a0 to easy-install.pth file
    Installing pildriver.py script to /home/robbie/git/myproject/venv/bin
    Installing pilprint.py script to /home/robbie/git/myproject/venv/bin
    Installing pilfile.py script to /home/robbie/git/myproject/venv/bin
    Installing pilconvert.py script to /home/robbie/git/myproject/venv/bin
    Installing pilfont.py script to /home/robbie/git/myproject/venv/bin

    Installed /home/robbie/git/myproject/venv/src/pil
Successfully installed PIL

Upvotes: 1

Views: 841

Answers (1)

Christian Ternus
Christian Ternus

Reputation: 8492

Try doing sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev, then symlinking the libraries like so:

ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib
ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib

and rerunning pip install, as described in this post.

Upvotes: 4

Related Questions