how to install PIL with directory into application

Pillow2.0 provides PIL automatically

You can build PIL with support for JPEG, Freetype, etc, on our CentOS6 servers without building those libraries locally in your home directory, and without setting environment variables likeLD_LIBRARY_PATH. Here are the steps:

First, download and extract the PIL tarball:

mkdir -p ~/src ~/lib/python2.7
cd ~/src
tar zxf PIL-1.1.7.tar.gz
cd PIL-1.1.7

Next, edit PIL's to set the library pointers as follows:

# --------------------------------------------------------------------
# Library pointers.
# Use None to look for the libraries in well-known library locations.
# Use a string to specify a single directory, for both the library and
# the include files. Use a tuple to specify separate directories:
# (libpath, includepath). Examples:
# JPEG_ROOT = "/home/libraries/jpeg-6b"
# TIFF_ROOT = "/opt/tiff/lib", "/opt/tiff/include"
# If you have "lib" and "include" directories under a common parent,
# you can use the "libinclude" helper:
# TIFF_ROOT = libinclude("/opt/tiff")

JPEG_ROOT = '/usr/lib64','/usr/include'
ZLIB_ROOT = '/lib64','/usr/include'
FREETYPE_ROOT = '/usr/lib64','/usr/include/freetype2/freetype'

Next, build PIL with the following command:

python2.7 build_ext -i

Next, run the test to confirm that the build was successful:

$ python2.7
Python modules loaded from ./PIL
Binary modules loaded from ./PIL
--- PIL CORE support ok
--- TKINTER support ok
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok
--- LITTLECMS support ok

Finally, install the library:

python2.7 install

if you need install directly into application:

PYTHONPATH=$HOME/webapps/427/Python-2.7/lib/python2.7 python2.7 install --install-lib=$HOME/webapps/427/Python-2.7/lib/python2.7 --install-scripts=$HOME/webapps/427/Python-2.7/bin --install-data=$HOME/webapps/427/Python-2.7/lib/python2.7


or vi $HOME/.bash_profile

add export PYTHONPATH="/home/kyholdings/lib/python2.7:$PYTHONPATH"

I've tested this with Pillow 2.0 and that version seems to solve the problem.

So, try modifying your buildout.cfg to install the newer version of Pillow,
then re-run buildout, then restart your instance.

You can do this by removing "PIL" from the "eggs" section of buildout.cfg, and
then modify the line for Pillow to read "Pillow==2.0.0"

Another way to do this would be to add "Pillow = 2.0.0" to the "versions"
section of buildout.cfg (you'll still want to remove PIL from the eggs section
though, since Pillow provides PIL automatically).

Ok, I think the difference is that when you installed Pillow 2.0 in your

buildout, it was build against /home/kyholdings/webapps/subaru/Python-2.7/include/jpeglib.h 
instead of the system jpeglib.h.

I've replaced your

First, install in your home directory, outside of your buildouts, like this:

cd ~
mkdir ~/lib/python2.7
easy_install-2.7 Pillow

At that point, I believe your buildouts will pick it up from that location, without the need to specifically add it to your buildout.

If you *do* still need to add it to your buildout, then do so as I described earlier in this ticket, then delete the Pillow-2.0.0-py2.7-linux-x86_64.egg directory from your buildout-cache/eggs directory, and copy the ~/lib/python2.7/Pillow-2.0.0-py2.7-linux-x86_64.egg in its place.