[ITK-users] Fwd: using simpleITK with anaconda python distribution

Vishwa vishwanath.somashekar at gmail.com
Fri Sep 12 19:59:56 EDT 2014


Hi Brad,
Thanks for all the help. I tried the conda install --use-local simpleitk
from the conda-recipes folder. It didn't seem to matter..

Here is the thing that I noticed..

If I add the path of the lib (~/anaconda/lib) to DYLD_LIBRARY_PATH, then i
can get it to work from the python that's invoked from the terminal.
However, when I try the same thing from the notebook or from spyder, I get
the following error.

>>import SimpleITK as sitk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK/__init__.py",
line 1, in <module>
    from .SimpleITK import *
  File
"/Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK/SimpleITK.py",
line 28, in <module>
    _SimpleITK = swig_import_helper()
  File
"/Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK/SimpleITK.py",
line 24, in swig_import_helper
    _mod = imp.load_module('_SimpleITK', fp, pathname, description)
ImportError:
dlopen(/Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK/_SimpleITK.so,
2): Library not loaded: libpng15.15.dylib
  Referenced from:
/Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK/_SimpleITK.so
  Reason: image not found

Any suggestions?

On Thu, Sep 11, 2014 at 7:36 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>
wrote:

> From [1] did you try:
>
> conda install --use-local simpleitk
>
> Brad
>
> [1] http://conda.pydata.org/docs/build_tutorials/pkgs.html
>
> On Sep 11, 2014, at 1:06 PM, Vishwa <vishwanath.somashekar at gmail.com>
> wrote:
>
> Hi All,
> I think python PythonPackage/setup.py installed wasn't in the location
> that the recipe calls for. I manually went to the location and ran the
> command. It was in the following folder
>
> /Users/dagarshali/anaconda/conda-bld/work/build/SimpleITK-build/Wrapping
>
> After that when I checked for simpleITK in
> /Users/dagarshali/anaconda/lib/python2.7/site-packages, I found
>
>
> /Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK
>
> Now, when I try to import simpleitk, i get an error which is shown below.
>
> >>> import SimpleITK as sitk
>
> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
>
>   File
> "/Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK/__init__.py",
> line 1, in <module>
>
>     from .SimpleITK import *
>
>   File
> "/Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK/SimpleITK.py",
> line 28, in <module>
>
>     _SimpleITK = swig_import_helper()
>
>   File
> "/Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK/SimpleITK.py",
> line 24, in swig_import_helper
>
>     _mod = imp.load_module('_SimpleITK', fp, pathname, description)
>
> ImportError:
> dlopen(/Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK/_SimpleITK.so,
> 2): Library not loaded: libjpeg.8.dylib
>
>   Referenced from:
> /Users/dagarshali/anaconda/lib/python2.7/site-packages/SimpleITK-0.8.0.post29-py2.7-macosx-10.5-x86_64.egg/SimpleITK/_SimpleITK.so
>
>   Reason: image not found
>
>
> I am guessing that's a progress from where I was. Any ideas to fix this
> one?
>
>
> Vishwa
>
> On Thu, Sep 11, 2014 at 11:18 AM, Vishwa <vishwanath.somashekar at gmail.com>
> wrote:
>
>> Hi,
>> I looked in ~/anaconda//lib/python2.7/site-packages and couldn't find
>> the simpleitk directory. I ran the conda build again and saved the log
>> file. I am attaching here for your reference. Hopefully, that should tell
>> us something.
>>
>> Vishwa
>>
>> On Thu, Sep 11, 2014 at 8:05 AM, Bradley Lowekamp <blowekamp at mail.nih.gov
>> > wrote:
>>
>>> Hello,
>>>
>>> First I would look at the output of the conda build. What that OK? Did
>>> it give a successful output? Next I would look into the site packages
>>> directory in your anaconda installation ( e.g. ~/anaconda//lib/python2.7/site-packages)
>>> for the SimpleITK directory.
>>>
>>> Brad
>>> On Sep 11, 2014, at 12:43 AM, Vishwa <vishwanath.somashekar at gmail.com>
>>> wrote:
>>>
>>>
>>>
>>> I did install anaconda again and ran the conda build like you suggest.
>>> It ran without and problem. However, when I import simpleitk, it gives a
>>> error saying no module found.
>>>
>>> Any ideas?
>>>
>>> Vishwa
>>>
>>> On Wed, Sep 10, 2014 at 10:10 AM, Bradley Lowekamp [via ITK Insight
>>> Users] <ml-node+s2283740n7586186h92 at n2.nabble.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> You need to use the conda build environment. Look at the readme in this
>>>> repo[1].
>>>>
>>>> Basically you'll need to do the following:
>>>>
>>>> $ conda install conda-build
>>>> $ cd src
>>>> $ git clone https://github.com/thewtex/conda-recipes.git
>>>> $ git checkout simpleitk-clone-url
>>>> $ conda build simpleitk
>>>>
>>>>
>>>>
>>>> [1] https://github.com/conda/conda-recipes
>>>>
>>>> On Sep 10, 2014, at 11:01 AM, Vishwa <[hidden email]
>>>> <http://user/SendEmail.jtp?type=node&node=7586186&i=0>> wrote:
>>>>
>>>> Thanks very much for the information. I looked at the conda recipe.
>>>> There are three files.
>>>> One is .sh file, the second is yaml file, and the third is just a test
>>>> code. How am i to use that recipe to compile..
>>>>
>>>> There are variables like Source_Dir in the .sh file. How do i get
>>>> those. I am not familiar using it.
>>>>
>>>> Am I to just copy the file build.sh into the SimpleITK source code
>>>> directly and run sh ./build.sh? I tried that, and it ran for a while and
>>>> gave an error.
>>>>
>>>> Best regards,
>>>> Vishwa
>>>>
>>>>
>>>>
>>>> On Wed, Sep 10, 2014 at 9:13 AM, Bradley Lowekamp <[hidden email]
>>>> <http://user/SendEmail.jtp?type=node&node=7586186&i=1>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> This error message frequently happens when SimpleITK is compiled
>>>>> against a different version of  Python than the runtime. This generally
>>>>> indicate there is something conflicting funny in your runtime environment.
>>>>>
>>>>> I was easily able to use the build script from the conda-recipes
>>>>> repository. I would strongly recommend this approach when building for the
>>>>> anaconda enviroment as it does simplify some of there issue. Your CMake
>>>>> configuration does look correct.
>>>>>
>>>>> You should look at you environment variables, such as PATH,
>>>>> DYLD_LIBRARY_PATH, and PYTHONPATH. Additionally look in you user install
>>>>> path [1]. You are looking for multiple copies of the SimpleITK module or
>>>>> library and or python runtime libraries which could confuse the linker.
>>>>>
>>>>> Also you can inspect the runtime libraries:
>>>>>
>>>>>  otool -L
>>>>> /Users/blowekamp/anaconda//lib/python2.7/site-packages/SimpleITK/_SimpleITK.so
>>>>>
>>>>> /Users/blowekamp/anaconda//lib/python2.7/site-packages/SimpleITK/_SimpleITK.so:
>>>>> @loader_path/../../../libpython2.7.dylib (compatibility version 2.7.0,
>>>>> current version 2.7.0)
>>>>> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
>>>>> (compatibility version 150.0.0, current version 855.17.0)
>>>>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
>>>>> version 1197.1.1)
>>>>> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
>>>>> version 60.0.0)
>>>>> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
>>>>> version 2577.0.0)
>>>>>
>>>>> [1]
>>>>> https://docs.python.org/2/install/#alternate-installation-the-user-scheme
>>>>>
>>>>> Hope this helps,
>>>>> Brad
>>>>>
>>>>> On Sep 9, 2014, at 10:55 PM, Vishwa <[hidden email]
>>>>> <http://user/SendEmail.jtp?type=node&node=7586186&i=2>> wrote:
>>>>>
>>>>> import SimpleITK as sitk
>>>>>
>>>>> Fatal Python error: PyThreadState_Get: no current thread
>>>>>
>>>>> Abort trap: 6
>>>>>
>>>>>
>>>>>
>>>>> _____________________________________
>>>>> Powered by www.kitware.com
>>>>>
>>>>> Visit other Kitware open-source projects at
>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>
>>>>> Kitware offers ITK Training Courses, for more information visit:
>>>>> http://www.kitware.com/products/protraining.php
>>>>>
>>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://public.kitware.com/mailman/listinfo/insight-users
>>>>>
>>>>>
>>>>
>>>>
>>>> _____________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://www.kitware.com/products/protraining.php
>>>>
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/insight-users
>>>>
>>>>
>>>> ------------------------------
>>>>  If you reply to this email, your message will be added to the
>>>> discussion below:
>>>>
>>>> http://itk-insight-users.2283740.n2.nabble.com/using-simpleITK-with-anaconda-python-distribution-tp7586179p7586186.html
>>>>  To unsubscribe from using simpleITK with anaconda python distribution, click
>>>> here
>>>> <http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7586179&code=ZGFnYXJzaGFsaUBnbWFpbC5jb218NzU4NjE3OXwtMTU3ODY3ODY5MQ==>
>>>> .
>>>> NAML
>>>> <http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>>
>>>
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.php
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/insight-users
>>>
>>>
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.php
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/insight-users
>>>
>>>
>>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20140912/e3a33429/attachment.html>


More information about the Insight-users mailing list