easy_install does not configure SimpleITK properly

455 views Asked by At

I'm trying to get some python code running on an EC2 server based on Amazon Linux. The code works fine on my local machine running ubuntu.

One of the dependencies is the SimpleITK module. I install it with

easy_install -U SimpleITK

And it installs successfully, I can import the module in the REPL. However, none of its functions are accessible, I get

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

and similar errors for all functions I need. After some investigation, it seems easy_install has somehow messed up the setup. On my local machine, when I do help(SimpleITK) I get the full list of functions, and crucially, the FILE is listed as :

/usr/local/lib/python2.7/.../SimpleITK/SimpleITK.py

But on the EC2 server, it is listed as

/usr/local/lib/python2.7/.../SimpleITK

I believe this is reason for the problems I am getting - on the server, python doesn't know that the 'file' it's talking about is actually a directory, and the actual source for the module is inside that directory.

I've tried reinstalling the module, upgrading setuptools, but the error remains. I tried installing with pip, but pip can't even find the module.

1

There are 1 answers

0
Roger Trullo On

I had the same issue and it was a problem of having several pythons; in my case anaconda and the one that comes with ubuntu. To solve it, I deleted the simpleitk package in each of them (pip uninstall simpleitk) using the pip of each python distribution. Then I installed it again using pip install with the anaconda executable.