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

Peter peter.bloomfield at camhpet.ca
Wed Feb 8 09:45:52 EST 2012


On Wednesday, February 08, 2012, Mathieu Stumpf wrote:
> >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 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/
> 
> 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

Thanks for this insight, I will go back to look at it on my test box.

> 
> 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.
> 
> Kind regards,
> Mathieu

There are a couple of things to look at,
	1. Check the permissions on the file libitksys-4.0.so.1 and directory
	2. Check if the directory containing libitksys-4.0.so.1 is in the LD_LIBRARY_PATH or setup a config file
	   in /etc/ld.so.conf.d and re-run ldconfig

Peter


More information about the Insight-users mailing list