SimpleITK install error on mac

I’m getting this error currently. I tried deleting all SimpleITK directories and rebuilding but I hit the same thing. When I have a chance I’ll try a completely clean build tree, but for now I’ll turn of SimpleITK in my build.

[ 81%] **Completed 'SimpleITK'**

[100%] Built target SimpleITK

[ 97%] **Performing install step for 'SimpleITK'**

-- SimpleITK: Removing 'install' log files

-- SimpleITK: SimpleITK_WORKING_DIR: /Users/pieper/slicer/latest/sbrew/SimpleITK-build/SimpleITK-build/Wrapping/Python

-- SimpleITK: /Users/pieper/slicer/latest/sbrew/python-install/bin/PythonSlicer;Packaging/;install

-- SimpleITK: Errors detected - See below.

running install

running bdist_egg

running egg_info

writing SimpleITK.egg-info/PKG-INFO

writing dependency_links to SimpleITK.egg-info/dependency_links.txt

writing top-level names to SimpleITK.egg-info/top_level.txt

reading manifest file 'SimpleITK.egg-info/SOURCES.txt'

writing manifest file 'SimpleITK.egg-info/SOURCES.txt'

installing library code to build/bdist.macosx-10.15-x86_64/egg

running install_lib

running build_py

running build_ext

copying /Users/pieper/slicer/latest/sbrew/SimpleITK-build/SimpleITK-build/Wrapping/Python/ -> build/lib.macosx-10.15-x86_64-3.6/SimpleITK/

creating build/bdist.macosx-10.15-x86_64/egg

creating build/bdist.macosx-10.15-x86_64/egg/SimpleITK

copying build/lib.macosx-10.15-x86_64-3.6/SimpleITK/ -> build/bdist.macosx-10.15-x86_64/egg/SimpleITK

copying build/lib.macosx-10.15-x86_64-3.6/SimpleITK/ -> build/bdist.macosx-10.15-x86_64/egg/SimpleITK

copying build/lib.macosx-10.15-x86_64-3.6/SimpleITK/ -> build/bdist.macosx-10.15-x86_64/egg/SimpleITK

byte-compiling build/bdist.macosx-10.15-x86_64/egg/SimpleITK/ to SimpleITK.cpython-36.pyc

byte-compiling build/bdist.macosx-10.15-x86_64/egg/SimpleITK/ to __init__.cpython-36.pyc

creating stub loader for SimpleITK/

byte-compiling build/bdist.macosx-10.15-x86_64/egg/SimpleITK/ to _SimpleITK.cpython-36.pyc

installing package data to build/bdist.macosx-10.15-x86_64/egg

running install_data

copying /Users/pieper/slicer/latest/sbrew/SimpleITK/LICENSE -> build/bdist.macosx-10.15-x86_64/egg/

copying /Users/pieper/slicer/latest/sbrew/SimpleITK/NOTICE -> build/bdist.macosx-10.15-x86_64/egg/

copying /Users/pieper/slicer/latest/sbrew/SimpleITK/ -> build/bdist.macosx-10.15-x86_64/egg/

copying /Users/pieper/slicer/latest/sbrew/SimpleITK-build/SimpleITK-build/ITK-5.1-NOTICE -> build/bdist.macosx-10.15-x86_64/egg/

copying /Users/pieper/slicer/latest/sbrew/SimpleITK-build/SimpleITK-build/ -> build/bdist.macosx-10.15-x86_64/egg/

creating build/bdist.macosx-10.15-x86_64/egg/EGG-INFO

copying SimpleITK.egg-info/PKG-INFO -> build/bdist.macosx-10.15-x86_64/egg/EGG-INFO

copying SimpleITK.egg-info/SOURCES.txt -> build/bdist.macosx-10.15-x86_64/egg/EGG-INFO

copying SimpleITK.egg-info/dependency_links.txt -> build/bdist.macosx-10.15-x86_64/egg/EGG-INFO

copying SimpleITK.egg-info/top_level.txt -> build/bdist.macosx-10.15-x86_64/egg/EGG-INFO

writing build/bdist.macosx-10.15-x86_64/egg/EGG-INFO/native_libs.txt

creating 'dist/SimpleITK-1.3.0.dev527-py3.6-macosx-10.15-x86_64.egg' and adding 'build/bdist.macosx-10.15-x86_64/egg' to it

removing 'build/bdist.macosx-10.15-x86_64/egg' (and everything under it)

Processing SimpleITK-1.3.0.dev527-py3.6-macosx-10.15-x86_64.egg

removing '/Users/pieper/slicer/latest/sbrew/python-install/lib/python3.6/site-packages/SimpleITK-1.3.0.dev527-py3.6-macosx-10.15-x86_64.egg' (and everything under it)

creating /Users/pieper/slicer/latest/sbrew/python-install/lib/python3.6/site-packages/SimpleITK-1.3.0.dev527-py3.6-macosx-10.15-x86_64.egg

Extracting SimpleITK-1.3.0.dev527-py3.6-macosx-10.15-x86_64.egg to /Users/pieper/slicer/latest/sbrew/python-install/lib/python3.6/site-packages

SimpleITK 1.3.0.dev527 is already the active version in easy-install.pth

Installed /Users/pieper/slicer/latest/sbrew/python-install/lib/python3.6/site-packages/SimpleITK-1.3.0.dev527-py3.6-macosx-10.15-x86_64.egg

Processing dependencies for SimpleITK==1.3.0.dev527

Searching for SimpleITK==1.3.0.dev527


zip_safe flag not set; analyzing archive contents...

SimpleITK.__pycache__.SimpleITK.cpython-36: module references __file__

SimpleITK.__pycache__._SimpleITK.cpython-36: module references __file__

No local packages or working download links found for SimpleITK==1.3.0.dev527

error: Could not find suitable distribution for Requirement.parse('SimpleITK==1.3.0.dev527')

CMake Error at /Users/pieper/slicer/latest/Slicer/CMake/ExternalProjectForNonCMakeProject.cmake:104 (message):

SimpleITK: install step failed with exit code '1'.

Outputs also captured in

/Users/pieper/slicer/latest/sbrew/SimpleITK_install_step_output.txt and


Setting env. variable EP_EXECUTE_DISABLE_CAPTURE_OUTPUTS to 1 allows to

disable file capture.

Call Stack (most recent call first):

/Users/pieper/slicer/latest/sbrew/SimpleITK_install_step.cmake:3 (ExternalProject_Execute)

make[3]: *** [SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-install] Error 1

make[2]: *** [CMakeFiles/SimpleITK.dir/all] Error 2

make[1]: *** [CMakeFiles/SimpleITK.dir/rule] Error 2

make: *** [SimpleITK] Error 2

rock:sbrew pieper$

There is a good chance that you could not properly clean your python site packages folders manually and that’s why it cannot find SimpleITK, so it would help if you could test with a clean build.

Clean build looks successful on the dashboard ( but sitkUtils test fail.

@jcfr @Sam_Horvath @jamesobutler Are you going to have time to look into this SimpleITK Mac issue? If not then maybe we should revert the ITK/SimpleITK update for now until someone has time to investigate.

1 Like

Sorry I don’t have access to a Mac right now to debug these Mac specific issues.

Deleting all SimpleITK and all [pP]ython* directories in the superbuild tree worked.

When I try to run a the MRHead through the MedianImageFilter I get this error in my local build, but the same operation work in the preview build of 2020-01-08.


@blowekamp do you have any clue what could have changed in ITK and SimpleITK to cause this problem? See change log here.


This error looks likely to be caused by the OSX peculiarities to dynamic_cast requirements to have the symbol be from the same compilation unit. The old OSX SDKs don’t have this behavior, so that is likely the difference between Steve’s and the preview build. This is not an issue for SimpleITK’s binary distribution but is a problem with it integrated into Slicer with all the duplicate ITK symbols from different libraries floating around.

I suspect that it was this commit which changed the behavior is Slicer:

Two things which may help the situation are:

  • set SimpleITK_EXPLICIT_INSTANTIATION=ON for OSX in the Superbuild.
  • Using setting SimpleITK to use static libraries. This will ensure all SimpleITK’s symbols are consistent, but would likely ensure dynamic_cast failures if the C++ API was used.

@blowekamp thanks a lot for the quick and helpful response.

@jcfr worked on removing all ITK symbol duplications in Slicer binaries for several years. It is terrible to hear that there are still problems around this.

We use the plain ITK API for C++ API. Can we just enable SimpleITK_EXPLICIT_INSTANTIATION or there would be other consequences?

The logic in the above commit in SimpleITK may need to be updated to automatically turn on SimpleITK_EXPLICIT_INSTANTIATION when shared libraries are enabled. I’ll have to do some testing.

It would be best if Slicer always explicitly enabled the above flag, as that is the way which has been working for Slicer.

1 Like

Thank you, I’ll enable this option then and we’ll see in tomorrow’s build if it indeed fixes the issue.

But Steve said:

So it’s OK with the preview builds, but not local builds compiled against a newer OSX SDK.

Confirmed, running this and rebuilding fixed the problem.

(cd SimpleITK-build/; cmake -D SimpleITK_EXPLICIT_INSTANTIATION:BOOL=ON .)

Any downsides to just adding that to the superbuild script?

I’ve added SimpleITK_EXPLICIT_INSTANTIATION:BOOL=ON to the superbuild script (