Openshift > Setup Python Image Library with support jpg, zlib and freetype
Author: Anastasia Panchenko
Aug. 18, 2014, 12:32 a.m.

Hello everyone! Today I was trying to add captcha field to my form and faced with little problem with PIL. By default it doesn't support a lot of needed libraries! I've got many useful info from here and here. With this docu I was afraid that I couldn't setup PIL correctly on my host mashine on Openshift. But result was successful. So I'd like to share with you my experience.

First af all we need to create for PIL all required symlinks.

For 32-bit Ubuntu:

sudo apt-get install libjpeg62 libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
ln -s /usr/lib/i386-linux-gnu/libfreetype.so /usr/lib/
ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/
ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/

Or for 64 bits architecture:

sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/
ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/

Or for my favourite Openshift:

ln -s /usr/lib64/libz.so $VIRTUAL_ENV/lib/
ln -s /usr/lib64/libfreetype.so $VIRTUAL_ENV/lib/
ln -s /usr/lib64/libjpeg.so $VIRTUAL_ENV/lib/

The next step is to download and configure PIL:

mkdir ~/src
cd ~/src
wget http://effbot.org/media/downloads/PIL-1.1.7.tar.gz
tar -xzvf PIL-1.1.7.tar.gz
cd PIL-1.1.7

Now we need to edit setup.py file and specify paths to libraries (symlinks). Find in setup.py the following lines and replace them:

# setup.py

...
TCL_ROOT = None
JPEG_ROOT = '/usr/lib64','/usr/include'
ZLIB_ROOT = '/lib64','/usr/include'
TIFF_ROOT = None
FREETYPE_ROOT = '/usr/lib64','/usr/include/freetype2/freetype'
LCMS_ROOT = None
...

Now let's save it and build:

python setup.py build_ext -i

We should see the following info:

-----------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
-----------------------------------------------------
version       1.1.7
platform      linux2 2.7.3 (default, May 18 2012, 14:51:16)
              [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]
-----------------------------------------------------
--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
--- LITTLECMS support available
-----------------------------------------------------

Great. Now let's install PIL:

python setup.py install

That's it. Now you can use all needed libraries from python code.

See also post How to add captcha to comment form

openshift
install
pil
pip

Greats, thanks

Worldwide Bentyl [url=http://costofcial.com]cialis online[/url] Buy Amoxicillin Antibodics Online Canada Tamoxifen Shopping Amoxicillin Urine Order Cialis Without Prescription Amoxicilina Sale Discount cialis Viagra 25mg Zithromax Z Mambo 36 Tadalafil 20 Mg http://costofcial.com - cialis online Propecia Prix Canadien Clomid Liqua Tech Labs
is taking viagra daily safe [url=http://viagrabs.com/]http://viagrabs.com/[/url] where is viagra available in bangalore viagra what happens if you take half of a viagra
loans online payday loans online direct lenders payday loans bad credit loans online no credit check
cheap ed meds online ed medicines generic for erectile dysfunction ed medications best ed medication what are the best generic ed drugs online erectile dysfunction medications ed medications compared cheap ed medication ed medications online ed drugs online best erectile dysfunction medication in canada ed drugs meds for ed erectile dysfunction medications sold in canada erectile dysfunction drugs generic ed drugs cheap erectile dysfunction drugs-canada canadian erectile dysfunction drugs ED medication order erectile dysfunction medication generic drugs for erectile dysfunction erectile meds ed drug cost comparison buy erectile dysfunction drugs generic ed medication erectile dysfunction medication prices ed meds on line cheap ed drugs best erectile dysfunction drugs for sale online erectile dysfunction drugs online meds for erectile dysfunction generic ed meds erectile dysfunction drugs canada ed drug best ed drug best deal on ED meds cheap ed meds medication from canada ed erectile dysfunction generic name for ED drugs buy erectile dysfunction drugs online cheap erectile dysfunction medication generic erectile dysfunction medications erectile dysfunction drugs comparison impotence drugs online common drugs for ed generic impotence drugs ed meds cost effective ed drugs canadian erectile dysfunction drugs rosa impex pvt ltd tadalafil generic vs cialis amoxicillin 500 mg canadian pharmacy buy lexapro india viagra pfizer 100mg viagra 100mg cheap canadian pharmacy no prescription free viagra sample before buying no prescription cialis
Keflex Swine Flu Pneumonia Usage Of Cephalexin [url=http://costofcial.com]cialis[/url] Buy Citodon On Sale Worldwide Elocon With Next Day Delivery Fast Delivery Viagrabest Online Price cialis buy online Zithromax With Alcohol Consumption Amoxicillin Effect On Kidneys Comprare Levitra Milano http://costofcial.com - viagra cialis Over Counter Med Comparable To Cialis Propecia Steiner
diet pills that work whats the best weight loss supplement garcinia cambogia weight loss medications weightloss pills

Leave a comment:

Name
Python
Web development
Review Linux
Administration
Provisioning CVS
Windows AWS
Continuous Integration
NoSql Logging Web Servers FileSystems Scala
accurev ansible apach2 apache api application approaches architecture archivation argparse arguments artifactory automation awk aws backup bash batch-scripting beaver block build built-in caching call captcha cartridge case certificates cgi chain client cloud cloudformation cluster cmd coding collections command-line commands compression conditionals conversion convert cookbook copy counter cron crud css cut cygwin daemon datatype date dd debpackage decorator delattr deploy deque dict distributed-file-systems django DNS domain driver dropbox dump elasticcache elasticsearch encryption exit ext4 extra-tags failover file filename filters for form format freetds functions gerrit getattribute gid git globals glusterfs hardware hook iam indexing inheritance init install job-interview jquery ldap linux list locals logging logs logstash lookup magicmethods mail main-menu metadata metalogger mongodb moosefs mount mssql multiplatform multithreading mysql netcat nginx nosql open-ssh openldap openshift os packaging parse partition path pattern patterns permissions pid pil pip pipe playbook pool post post-commit processes production provisioning proxy putty python python-mysql recursively redirection redis register replication repr restore return review rotation scala script search selenium server setattr settings setup shipper signals singleton slots snapshot socket splunk ssh ssh-key ssl storage str string style subprocess sugar super switch syntactic syntaxhighlighter systeminfo tail tar templatetags time tls tune2fs tuple ubuntu unicode unique unix unixodbc usage usecases uuid uwsgi variable vars version vi virtualenv volume web web-server windows with_items __getattr__