Python, Django and virtualenv

software development

#1

Hi folks,

I have installed Django application on Dreamhost, and it’s working great, but I need a bit more.

The application I’ve made needs Python Imaging Library(PIL) and also will need hashlib, so I need some extra things in my Python installation.

After realizing, that there is no PIL in standard instalation of Python (Django throw me an error), I went to dreamhost wiki(http://wiki.dreamhost.com/Python), and decided to install virtualenv.

Here is step by step what i’ve made:

$ wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.1.tar.gz
$ tar xzf virtualenv-1.1.tar.gz
$ python2.4 virtualenv-1.1/virtualenv.py $HOME/local

and then:
$ echo “source $HOME/local/bin/activate” >> ~/.bash_profile
$ source ~/.bash_profile

So theoreticaly, everything went great, and I tried to install PIL, but everything was wrong:
(local)[rossmore]$ easy_install PIL (i tried also python2.4 easy_install PIL)
Searching for PIL
Reading http://pypi.python.org/simple/PIL/
Reading http://www.pythonware.com/products/pil
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://effbot.org/downloads/#Imaging
No local packages or download links found for PIL
error: Could not find suitable distribution for Requirement.parse(‘PIL’)

But after reading documentation of PIL I was quite sure it should work(PIL works with python 2.4), and version should fit.

I tried then to install it with direct addres to package:

(local)[rossmore]$ easy_install http://effbot.org/downloads/Imaging-1.1.6.tar.gz
Searching for PIL
Reading http://pypi.python.org/simple/PIL/
Reading http://www.pythonware.com/products/pil
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://effbot.org/downloads/#Imaging
No local packages or download links found for PIL
error: Could not find suitable distribution for Requirement.parse(‘PIL’)
(local)[rossmore]$ python2.4 easy_install http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
Downloading http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
Processing Imaging-1.1.6.tar.gz
Running Imaging-1.1.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-sF7Z0s/Imaging-1.1.6/egg-dist-tmp-vK_Qor
libImaging/Effects.c:210: warning: perlin_init' defined but not used libImaging/Geometry.c:236: warning:quadratic_transform’ defined but not used
libImaging/Quant.c:311: warning: test_sorted' defined but not used libImaging/QuantHash.c:136: warning:_hashtable_test’ defined but not used

PIL 1.1.6 BUILD SUMMARY

version 1.1.6
platform linux2 2.4.4 (#2, Apr 29 2008, 08:45:14)
[GCC 3.3.5 (Debian 1:3.3.5-13)]

*** TKINTER support not available
— JPEG support ok
— ZLIB (PNG/ZIP) support ok
— FREETYPE2 support ok

*** Warning: zlib 1.2.2 may contain a security vulnerability.
*** Consider upgrading to zlib 1.2.3 or newer.
*** See: http://www.kb.cert.org/vuls/id/238678
http://www.kb.cert.org/vuls/id/680620
http://www.gzip.org/zlib/advisory-2002-03-11.txt


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.
zip_safe flag not set; analyzing archive contents…
IcnsImagePlugin: top-level module may be ‘python -m’ script
Image: module references file
ImageFileIO: top-level module may be ‘python -m’ script
ImageFont: top-level module may be ‘python -m’ script
ImageStat: top-level module may be ‘python -m’ script
OleFileIO: top-level module may be ‘python -m’ script
SpiderImagePlugin: top-level module may be ‘python -m’ script
WalImageFile: top-level module may be ‘python -m’ script
Adding PIL 1.1.6 to easy-install.pth file
Installing pilconvert.py script to /home/nsorg/local/bin
Installing pildriver.py script to /home/nsorg/local/bin
Installing pilfile.py script to /home/nsorg/local/bin
Installing pilfont.py script to /home/nsorg/local/bin
Installing pilprint.py script to /home/nsorg/local/bin

Installed /home/.bobbin/nsorg/local/lib/python2.4/site-packages/PIL-1.1.6-py2.4-linux-i686 .egg
Processing dependencies for PIL==1.1.6
Finished processing dependencies for PIL==1.1.6
(local)[rossmore]$ python2.4 easy_install PIL
Searching for PIL
Best match: PIL 1.1.6
Processing PIL-1.1.6-py2.4-linux-i686.egg
PIL 1.1.6 is already the active version in easy-install.pth
Installing pilconvert.py script to /home/nsorg/local/bin
Installing pildriver.py script to /home/nsorg/local/bin
Installing pilfile.py script to /home/nsorg/local/bin
Installing pilfont.py script to /home/nsorg/local/bin
Installing pilprint.py script to /home/nsorg/local/bin

Using /home/.bobbin/nsorg/local/lib/python2.4/site-packages/PIL-1.1.6-py2.4-linux-i686 .egg
Processing dependencies for PIL
Finished processing dependencies for PIL

BUT, when i try to load this module in python shell:

(local)[rossmore]$ python
Python 2.4.4 (#2, Apr 29 2008, 08:45:14)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

[/quote]

Traceback (most recent call last):
File “”, line 1, in ?
ImportError: No module named PIL

So it doesn’t work, and I have no clue why. I’m a bit shaky in python and virtualmod area, and it always big problem for me to install additional modules in different hostings.

I hope you will be able to help me. I would be realy appreciated for any help.