[Insight-users] ITK Python installation problem

Sami Koho sami.koho at gmail.com
Wed Feb 26 06:28:30 EST 2014


Hello,

I seem to have a problem with ITK installation on 64-bit Ubuntu 12.04. 
Previously I have been using ITK on another workstation (Debian OS) 
without any problems. It seems that somehow ITK Python interface cannot 
find the shared object (.so) files. 

When I import ITK in Python, everything seems to work nicely:

 In [1]: import itk

In [2]: import sys

In [3]: print sys.path
['', '/usr/bin', '/usr/lib/python2.7', 
'/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', 
'/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', 
'/usr/local/lib/python2.7/dist-packages', 
'/usr/lib/python2.7/dist-packages', 
'/usr/lib/python2.7/dist-packages/PIL', 
'/usr/local/lib/ITK-4.6/Python', '/usr/local/lib', 
'/usr/lib/python2.7/dist-packages/gst-0.10', 
'/usr/lib/python2.7/dist-packages/gtk-2.0', 
'/usr/lib/pymodules/python2.7', 
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client', 
'/usr/lib/python2.7/dist-packages/ubuntuone-client', 
'/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', 
'/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', 
'/usr/lib/python2.7/dist-packages/IPython/extensions', 
'/usr/local/lib/ITK-4.6/Python/Configuration/..', 
'/usr/local/lib/ITK-4.6/Python/Configuration/../../lib']

In [4]: 

However, when I try to do something with ITK, the following happens:

In [5]: reader = itk.ImageFileReader.IUC3.New()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/sami/Programming/GIT/image-processing/Test/<ipython-input-5-8e289c4078ab> 
in <module>()
----> 1 reader = itk.ImageFileReader.IUC3.New()

/usr/local/lib/ITK-4.6/Python/itkLazy.py in __getattribute__(self, attr)
     40 module = self.__lazy_attributes[attr]
     41 namespace = {}
---> 42 itkBase.LoadModule(module, namespace)
     43 # Load into 'namespace' first, then self.__dict__ (via 
setattr) to

     44 # prevent the warnings about overwriting the 'NotLoaded' 
values


/usr/local/lib/ITK-4.6/Python/itkBase.py in LoadModule(name, namespace)
     49 if namespace is not None:
     50 swig = namespace.setdefault('swig', imp.new_module('swig'))
---> 51 swig.__dict__.update(this_module.swig.__dict__)
     52 
     53 # don't worry about overwriting the symbols in namespace -- 
any


AttributeError: 'module' object has no attribute 'swig'

In [6]: 

I suppose, some environment variable has not been set correctly. 
DYLD_LIBRARY_PATH seems to point into /usr/local/lib.

The examples are for a GIT development build of ITK. I get the same 
error with ITK 4.5.1, so it seems something is a bit different in 
Ubuntu than in Debian. Any ideas?

Best,

Sami




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140226/34d2481a/attachment.html>


More information about the Insight-users mailing list