Error importing Python Imaging Library (PIL)

Hi all,

I'm a matplotlib newbie and have recently installed matplotlib as part
of the Python(x,y) distribution for Windows. I want to do some image
manipulation (e.g. basemap.warpimage()) and my initial installation
didn't have the Python Imaging Library (PIL) installed, so I installed
this via easy_install:

easy_install PIL

This worked, but it was installed in such a way that the import command

from PIL import Image

doesn't work (it seems that "import Image" works instead). This means
that basemap.warpimage() does not work because it expects to be able
to import PIL through the former expression. I can try to install PIL
some other way, but does this indicate that the basemap module should
try both ways of importing PIL, as different users might have
different setups? Is there a quick fix that I could apply?

(Apologies if this question has been asked before - I did some
Googling and didn't find anything.)

Regards, Jon

···

--
Dr Jon Blower
Technical Director, Reading e-Science Centre
Environmental Systems Science Centre
University of Reading
Harry Pitt Building, 3 Earley Gate
Reading RG6 6AL. UK
Tel: +44 (0)118 378 5213
Fax: +44 (0)118 378 6413
j.d.blower@...2446...
http://www.nerc-essc.ac.uk/People/Staff/Blower_J.htm

Jon Blower wrote:

Hi all,

I'm a matplotlib newbie and have recently installed matplotlib as part
of the Python(x,y) distribution for Windows. I want to do some image
manipulation (e.g. basemap.warpimage()) and my initial installation
didn't have the Python Imaging Library (PIL) installed, so I installed
this via easy_install:

easy_install PIL

This worked, but it was installed in such a way that the import command

from PIL import Image

doesn't work (it seems that "import Image" works instead). This means
that basemap.warpimage() does not work because it expects to be able
to import PIL through the former expression. I can try to install PIL
some other way, but does this indicate that the basemap module should
try both ways of importing PIL, as different users might have
different setups? Is there a quick fix that I could apply?

(Apologies if this question has been asked before - I did some
Googling and didn't find anything.)

Regards, Jon

Jon: It seems like PIL is not "setuptools-aware"...

http://mail.python.org/pipermail/image-sig/2007-May/004451.html

PIL does not get installed correctly using setuptools. You'll need to install the old-fashioned way, i.e. "python setup.py install".

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

Dear Dr. Blower,

I would by all means suggest the Enthought Python Distribution
(http://www.enthought.com/) in place of Python(x,y). EPD already
includes PIL, MPL and Basemap (although in a somewhat "abridged" and
outdated version, but this is just a matter of upgrading).

Hope this helps.

Best regards,

2009/1/13 Jon Blower <j.d.blower@...2446...>:

···

Hi all,

I'm a matplotlib newbie and have recently installed matplotlib as part
of the Python(x,y) distribution for Windows. I want to do some image
manipulation (e.g. basemap.warpimage()) and my initial installation
didn't have the Python Imaging Library (PIL) installed, so I installed
this via easy_install:

easy_install PIL

This worked, but it was installed in such a way that the import command

from PIL import Image

doesn't work (it seems that "import Image" works instead). This means
that basemap.warpimage() does not work because it expects to be able
to import PIL through the former expression. I can try to install PIL
some other way, but does this indicate that the basemap module should
try both ways of importing PIL, as different users might have
different setups? Is there a quick fix that I could apply?

(Apologies if this question has been asked before - I did some
Googling and didn't find anything.)

Regards, Jon

--
Dr Jon Blower
Technical Director, Reading e-Science Centre
Environmental Systems Science Centre
University of Reading
Harry Pitt Building, 3 Earley Gate
Reading RG6 6AL. UK
Tel: +44 (0)118 378 5213
Fax: +44 (0)118 378 6413
j.d.blower@...2446...
http://www.nerc-essc.ac.uk/People/Staff/Blower_J.htm

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."

Jon: It seems like PIL is not "setuptools-aware"...

Thanks Jeff, this is good to know. I went back and reinstalled
Python(x,y) and installed PIL as part of the setup options, then it
all worked fine. Very useful to know that sometimes easy_install
isn't the right option for installing plugins.

(Thanks also to Mauro for your suggestion.)

Regards, Jon

2009/1/13 Jeff Whitaker <jswhit@...146...>:

···

Jon Blower wrote:

Hi all,

I'm a matplotlib newbie and have recently installed matplotlib as part
of the Python(x,y) distribution for Windows. I want to do some image
manipulation (e.g. basemap.warpimage()) and my initial installation
didn't have the Python Imaging Library (PIL) installed, so I installed
this via easy_install:

easy_install PIL

This worked, but it was installed in such a way that the import command

from PIL import Image

doesn't work (it seems that "import Image" works instead). This means
that basemap.warpimage() does not work because it expects to be able
to import PIL through the former expression. I can try to install PIL
some other way, but does this indicate that the basemap module should
try both ways of importing PIL, as different users might have
different setups? Is there a quick fix that I could apply?

(Apologies if this question has been asked before - I did some
Googling and didn't find anything.)

Regards, Jon

Jon: It seems like PIL is not "setuptools-aware"...

http://mail.python.org/pipermail/image-sig/2007-May/004451.html

PIL does not get installed correctly using setuptools. You'll need to
install the old-fashioned way, i.e. "python setup.py install".

-Jeff

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

--
Dr Jon Blower
Technical Director, Reading e-Science Centre
Environmental Systems Science Centre
University of Reading
Harry Pitt Building, 3 Earley Gate
Reading RG6 6AL. UK
Tel: +44 (0)118 378 5213
Fax: +44 (0)118 378 6413
j.d.blower@...2446...
http://www.nerc-essc.ac.uk/People/Staff/Blower_J.htm