[SciPy-user] SciPy autotester fails on pilutil

Tanja Gurzhiy tanja.gurzhiy@gmail....
Thu May 7 04:32:37 CDT 2009


Hi all,



Thanks for your answers. Sorry, but I still a bit confused....I have PIL.pth
in site-packages directory. And by the way, I also have SciPy version under
the Windows where PIL works just fine with "import Image"...



Coming back to my SciPy under SUN. I’ve checked the readme file for PIL (I
use PIL 1.1.6) - till the PIL version 1.1.4 it is recommended to add the PIL
in PYTHONPATH

Then type (assuming a standard shell):



        $ PYTHONPATH=.:./PIL ; export PYTHONPATH

        $ python



        >>> import _imaging

        >>> import Image



If both imports works, you've successfully added PIL to your Python
environment.



However, in PIL version 1.1.5-1.1.6 it is not mentioned about the
requirement to add PIL to PYTHONPATH ( $ PYTHONPATH=.:./PIL ; export
PYTHONPATH). So, what is the current situation - do I need to add PIL to my
PYTHONPATH in order to make import Image direct? I think it is the only
solution for me (because PYTHONPATH environment variable defines what
directories the python interpreter searches for modules) otherwise the
source of pilutil.py of needs to be updated with “from PIL import Image”.



Christopher Barker wrote:

>FWIW, I think "import Image" is deprecated, in favor of "from PIL import
>Image", which removes the need for the pth file. The PIL packge has a
>LOT of stuff in it, you really don't want all of it on your sys.path.



How can I see/find that ‘import Inage” is deprecated? I use the newest
version of SciPy and it is still uses ‘import Image”. I also think the usage
of "from PIL import Image" makes a code more readable and structured.



Kind regards,

Tanja Gurzhiy


On Wed, May 6, 2009 at 5:05 PM, Tanja Gurzhiy <tanja.gurzhiy@gmail.com>wrote:

> Hi all,
>
>
>
> I am currently busy with SciPy 0.7.0 installation (I have NumPy v1.3.0
> installed and PIL v).
>
> If I run the scipy autotester (scipy.test()), I get the failure in testcase
> from scipy.misc
>
> ERROR: Failure: ImportError (No module named Image)
>
> ----------------------------------------------------------------------
>
> Traceback (most recent call last):
>
>   File
> "/scratch/sources/numpy/nose-0.10.4-install/lib/python2.5/site-packages/nose/loader.py",
> line 364, in loadTestsFromName     addr.filename, addr.module)
>
>   File
> "/scratch/sources/numpy/nose-0.10.4-install/lib/python2.5/site-packages/nose/importer.py",
> line 39, in importFromPath     return self.importFromDir(dir_path, fqname)
>
>   File
> "/scratch/sources/numpy/nose-0.10.4-install/lib/python2.5/site-packages/nose/importer.py",
> line 84, in importFromDir     mod = load_module(part_fqname, fh, filename,
> desc)
>
>   File "/home/tgurzhiy/cadlib/scipy/misc/tests/test_pilutil.py", line 12,
> in <module>
>
>     import scipy.misc.pilutil as pilutil
>
>   File
> "/cadappl/python_scipy/0.7.0/python_scipy/lib/python2.5/site-packages/scipy/misc/pilutil.py",
> line 10, in <module>     import Image
>
> ImportError: No module named Image
>
>
>
>
>
> In pilutil.py line 10 use import Image, the module Image is located in PIL.
> In my case PYTHONPATH includes only directory (~/cadlib) that includes PIL,
> NumPy, matloptlib and SciPy therefore module Image cannot be imported
> directly if scipy.test() is ran.
>
>
>
> As consequences of this error in pilutil, the functions from this file
> cannot be used (e.g., imread, imshow, etc.)
>
>
>
> >>> from scipy import misc
>
> >>> im = misc.lena()
>
> >>> im.shape
>
> (512, 512)
>
> >>> im1= misc.imresize(im,1.1)
>
> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
>
> AttributeError: 'module' object has no attribute 'imresize'
>
>
>
> Why scipy/misc/pilutil.py uses direct import Image and not import
> PIL.Image?  The work-around could be to update my PYTHONPATH with
> ~/cadlib/PIL , but I think it is not what should be done. Correct me if I am
> wrong.
>
>
>
> Best regards,
>
> Tanja Gurzhiy
>
>
>
> Please find below the information about my system, platform, etc.
>
>
>
> 'from numpy.f2py.diagnose import run; run()
>
>
>
> os.name='posix'
>
> ------
>
> sys.platform='sunos5'
>
> ------
>
> sys.version:
>
> 2.5.1 (r251:54863, Aug  6 2008, 14:27:55)
>
> [GCC 3.4.3]
>
> ------
>
> sys.prefix:
>
> /home/tgurzhiy/.caddata/python/python
>
> ------
>
>
> sys.path='/usr/local/asm::/home/tgurzhiy/cadlib:/usr/local/asm/lib/python:/usr/local/asm/bin/python:/scratch/sources/numpy/nose-0.10.4-install/lib/python2.5/site-packages:/home/tgurzhiy/.caddata/python/python/lib/python25.zip:/home/tgurzhiy/.caddata/python/python/lib/python2.5:/home/tgurzhiy/.caddata/python/python/lib/python2.5/plat-sunos5:/home/tgurzhiy/.caddata/python/python/lib/python2.5/lib-tk:/home/tgurzhiy/.caddata/python/python/lib/python2.5/lib-dynload:/home/tgurzhiy/.caddata/python/python/lib/python2.5/site-packages'
>
> ------
>
> Failed to import Numeric: No module named Numeric
>
> Failed to import numarray: No module named numarray
>
> Found new numpy version '1.3.0' in /home/tgurzhiy/cadlib/numpy/__init__.pyc
>
> Found f2py2e version '2' in /home/tgurzhiy/cadlib/numpy/f2py/f2py2e.pyc
>
> Found numpy.distutils version '0.4.0' in
> '/home/tgurzhiy/cadlib/numpy/distutils/__init__.pyc'
>
> ------
>
> Importing numpy.distutils.fcompiler ... ok
>
> ------
>
> Checking availability of supported Fortran compilers:
>
> GnuFCompiler instance properties:
>
>   archiver        = ['/home/tgurzhiy/cadbin/g77', '-cr']
>
>   compile_switch  = '-c'
>
>   compiler_f77    = ['/home/tgurzhiy/cadbin/g77', '-g', '-Wall', '-fno-
>
>                     second-underscore', '-fPIC', '-O3', '-funroll-loops']
>
>   compiler_f90    = None
>
>   compiler_fix    = None
>
>   libraries       = ['g2c']
>
>   library_dirs    =
> ['/home/cadappl/gcc/3.4.3/gcc/bin/../lib/gcc/sparc-sun-
>
>                     solaris2.8/3.4.3']
>
>   linker_exe      = ['/home/tgurzhiy/cadbin/g77', '-g', '-Wall', '-g', '-
>
>                     Wall']
>
>   linker_so       = ['/home/tgurzhiy/cadbin/g77', '-g', '-Wall', '-g', '-
>
>                     Wall', '-shared', '-mimpure-text']
>
>   object_switch   = '-o '
>
>   ranlib          = ['/home/tgurzhiy/cadbin/g77']
>
>   version         = LooseVersion ('3.4.3')
>
>   version_cmd     = ['/home/tgurzhiy/cadbin/g77', '--version']
>
> Fortran compilers found:
>
>   --fcompiler=gnu  GNU Fortran 77 compiler (3.4.3)
>
> Compilers available for this platform, but not found:
>
>   --fcompiler=g95    G95 Fortran Compiler
>
>   --fcompiler=gnu95  GNU Fortran 95 compiler
>
>   --fcompiler=sun    Sun or Forte Fortran 95 Compiler
>
> Compilers not available on this platform:
>
>   --fcompiler=absoft   Absoft Corp Fortran Compiler
>
>   --fcompiler=compaq   Compaq Fortran Compiler
>
>   --fcompiler=hpux     HP Fortran 90 Compiler
>
>   --fcompiler=ibm      IBM XL Fortran Compiler
>
>   --fcompiler=intel    Intel Fortran Compiler for 32-bit apps
>
>   --fcompiler=intele   Intel Fortran Compiler for Itanium apps
>
>   --fcompiler=intelem  Intel Fortran Compiler for EM64T-based apps
>
>   --fcompiler=intelev  Intel Visual Fortran Compiler for Itanium apps
>
>   --fcompiler=intelv   Intel Visual Fortran Compiler for 32-bit apps
>
>   --fcompiler=lahey    Lahey/Fujitsu Fortran 95 Compiler
>
>   --fcompiler=mips     MIPSpro Fortran Compiler
>
>   --fcompiler=nag      NAGWare Fortran 95 Compiler
>
>   --fcompiler=none     Fake Fortran compiler
>
>   --fcompiler=pg       Portland Group Fortran Compiler
>
>   --fcompiler=vast     Pacific-Sierra Research Fortran 90 Compiler
>
> For compiler details, run 'config_fc --verbose' setup command.
>
> ------
>
> Importing numpy.distutils.cpuinfo ... ok
>
> ------
>
> CPU information: CPUInfoBase__get_nbits getNCPUs is_32bit is_cpusparcv9
> is_sparcv9 is_sun4 ------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20090507/26032b9a/attachment-0001.html 


More information about the SciPy-user mailing list