[Setup] Re: PIL is not installed properly

Joe Bigler jeb6 at psu.edu
Tue Aug 15 18:20:00 UTC 2006



Thanks for the help.  I think you identified the problem.  

If I go to python in my Zope installation and run

>>> import pil
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named pil

It appears that pil is not installed.  

I went to the Pil site to get the installtion file

I downloaded 

Python Imaging Library 1.1.5 for Python 2.4 (off-site link) (Windows only)

Here's the problem:

When I run the install, it must find a registered version of Python.  I did
have another instance of Python installed at C:\Python24 (version 2.4.3)
It installed PIL to this instance, but did not work, since it is not the
instance in Zope.  I tried uninstalling the C:\Python24.  Now it can't find
any instance and won't let me enter one.

I found a script on the site for registering a version of Python in Windows.
Here it is:

import sys

from _winreg import *

# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix

regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%sLib\\;%sDLLs\\" % (
    installpath, installpath, installpath

def RegisterPy():
        reg = OpenKey(HKEY_LOCAL_MACHINE, regpath)
    except EnvironmentError:
            reg = CreateKey(HKEY_LOCAL_MACHINE, regpath)
            SetValue(reg, installkey, REG_SZ, installpath)
            SetValue(reg, pythonkey, REG_SZ, pythonpath)
            print "*** Unable to register!"
        print "--- Python", version, "is now registered!"
    if (QueryValue(reg, installkey) == installpath and
        QueryValue(reg, pythonkey) == pythonpath):
        print "=== Python", version, "is already registered!"
    print "*** Unable to register!"
    print "*** You probably have another Python installation!"

if __name__ == "__main__":

I am very new to Python.  I saved the script and ran it under python.  It
still isn't registered.

I believe I need to set two variables:
installkey = "InstallPath"
pythonkey = "PythonPath"

Here is what I think they might be, but I am not sure:
pythonkey = "C:\Program Files\Zope-2.9.3\bin"  This is where python.exe

I am not sure where the InstallPath should be.  I am guessing
"C:\Program Files\Zope-2.9.3\bin\libs\"  because I noticed that when I
installed Pil to my C:\Python24 instance, it created a folder called libs,
which isn't in the Zope install.

I hesitate to try this since it changes the registry.  Nick, I appreciate
your and anybody else's thoughts on this before I try it. 

One other question.  Should my install of Zope normally registered Python
(and PIL)?  If so, would it make sense to reinstall Zope?  If so, can I do
that without losing anything I have already developed and setup?

Thanks for all replies in advance.


-----Original Message-----
From: Nick Davis [mailto:nd51 at le.ac.uk] 
Sent: Tuesday, August 15, 2006 4:45 AM
To: setup at lists.plone.org
Subject: [Setup] Re: PIL is not installed properly

Joe Bigler wrote:

> Is there any way I can fix the warning message about PIL not being
> installed?

Yes. Probably by actually installing PIL.  ;-)

I think this is one of the (possibly rare) occasions when an error 
message does actually mean what it says.  ;-)

Googling for "PIL Python Windows" revealed :

If you're sure you've already got PIL in the python 2.4 version (which 
you can test by something like import PIL) then its a path issue.

Perhaps Plone's on-line documentation is unclear about the fact the PIL 
is an external pre-requisite......



Nick Davis
Web Application Developer
University of Leicester

More information about the Setup mailing list