[Insight-users] ITK V4.0.0 with Python Wrapping

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Wed Feb 8 10:03:03 EST 2012


Hi,

Le 8 févr. 12 à 15:38, Mathieu Stumpf a écrit :

>> Hi there,
>>
>> I am missing something during the compile/installation of ITK  
>> V4.0.0 on
> a 64-bit openSUSE machine. I have used previous versions
>> of ITK from within python, but I have missed something under V4.0.0.
>>
>> From within cmake, I have ticked the boxes 'BUILD_SHARED_LIBS',
> 'ITK_USE_REVIEW' and 'WRAP_ITK_PYTHON' and generated a Makefile.
>> The compilation and install executes without error.
>>
>> When I go into python, I get the following,
>> 	Python 2.7 (r27:82500, Aug 07 2010, 16:54:59) [GCC] on linux2
>> 	Type "help", "copyright", "credits" or "license" for more  
>> information.
>> 	>>> import itk
>> 	>>> itk.Version
>> 	PySwigIterator not found in module ITKPyBase because of exception:
>> 	 'module' object has no attribute 'PySwigIterator'
>> 	PySwigIterator not found in module ITKPyBase because of exception:
>> 	 'module' object has no attribute 'PySwigIterator'
>> 	<class 'ITKCommonBasePython.itkVersion'>
>>
>> Any hints or suggestions to resolve this will be most appreciated,
> thanks

I'm not sure what is causing that.
Could you tell us which swig version you've used?

>
>
> I have the same problem here, on a Linux version 2.6.32-5-amd64  
> (Debian
> 2.6.32-41), using the ITK tarball stable release.
>
> Moreover when I was seeking for the wrapper's install path (to set the
> env path), I found that :
>  $ ls /usr/local/lib/cmake/ITK-4.0/WrapITK/
>  ;CACHE;INTERNAL;PATH;subpath where where most of WrapITK files will  
> be
> installed
>
> (the thing being listed is a directory name)
> Seems like there's a problem with the installation scripts.
>
> Anyway, I renamed this directory to src and set my env path like  
> that :
>
>        export ITKWRAPPEDINSTALLED=/usr/local/lib/cmake/ITK-4.0/ 
> WrapITK/src/
>        export LD_LIBRARY_PATH=$ITKWRAPPEDINSTALLED: 
> $ITKWRAPPEDINSTALLED/WrapITK/lib:/usr/local/lib/vtk-5.8/
>        export PYTHONPATH=$ITKWRAPPEDINSTALLED/WrapITK/lib/: 
> $ITKWRAPPEDINSTALLED/WrapITK/Python/
>

I think that

   export LD_LIBRARY_PATH=/usr/local/lib/
   export PYTHONPATH=/usr/local/lib/ITK-4.0/Python

should be enough for python wrapping. Note that you probably don't  
have to set LD_LIBRARY_PATH to /usr/local/lib/, as it's probably  
already done on your system.

> Here is what the famous previous dir contains :
>        $ ls /usr/local/lib/cmake/ITK-4.0/WrapITK/src/**
>        /usr/local/lib/cmake/ITK-4.0/WrapITK/src/WrapITKConfig.cmake
>
>        /usr/local/lib/cmake/ITK-4.0/WrapITK/src/Configuration:
>        CMakeUtilityFunctions.cmake  Generators            
> Typedefs              WrapITKTypes.cmake
>        ConfigureWrapping.cmake      TypedefMacros.cmake   
> WrapBasicTypes.cmake
>
>
> And my complete python error:
>>>> import itk
>>>> ls
>        Traceback (most recent call last):
>          File "<stdin>", line 1, in <module>
>        NameError: name 'ls' is not defined
>>>> lecteur1 =  
>>>> itk.ImageFileReader.IUC2.New(Filename=CellsFluorescence1.png)
>        PySwigIterator not found in module ITKPyBase because of  
> exception:
>         'module' object has no attribute 'PySwigIterator'
>        PySwigIterator not found in module ITKPyBase because of  
> exception:
>         'module' object has no attribute 'PySwigIterator'
>        Traceback (most recent call last):
>          File "<stdin>", line 1, in <module>
>          File "/usr/local/lib/ITK-4.0/Python/itkLazy.py", line 37,  
> in __getattribute__
>            itkBase.LoadModule(module, namespace)
>          File "/usr/local/lib/ITK-4.0/Python/itkBase.py", line 95,  
> in LoadModule
>            LoadModule(dep, namespace)
>          File "/usr/local/lib/ITK-4.0/Python/itkBase.py", line 103,  
> in LoadModule
>            if not swigModuleName in sys.modules: module =  
> loader.load(swigModuleName)
>          File "/usr/local/lib/ITK-4.0/Python/itkBase.py", line 214,  
> in load
>            return imp.load_module(name, fp, pathname, description)
>          File "/usr/local/lib/ITK-4.0/Python/ITKCommonPython.py",  
> line 30, in <module>
>            _ITKCommonPython = swig_import_helper()
>          File "/usr/local/lib/ITK-4.0/Python/ITKCommonPython.py",  
> line 26, in swig_import_helper
>            _mod = imp.load_module('_ITKCommonPython', fp, pathname,  
> description)
>        ImportError: libitksys-4.0.so.1: cannot open shared object  
> file: No such file or directory
>
> Hope that someone will be able to help me.


libitksys-4.0.so.1 should be in /usr/local/lib. Making sure that this  
path is in your system library path and running

   ldconfig

as root may help.

Regards,

Gaëtan

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://mima2.jouy.inra.fr  http://www.itk.org
http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120208/72e12116/attachment.pgp>


More information about the Insight-users mailing list