[Insight-users] Recent regression: can't wrap non-apple Python on Darwin/OS X

Zachary Pincus zpincus at stanford.edu
Mon, 16 Feb 2004 13:08:31 -0800


Hello,

With ITK 1.6 on Darwin, it was possible to create (sort of working) 
python wrappers for versions of Python not supplied by Apple. It is no 
longer possible to do so with the current CVS version of ITK.

That is, in the ccmake configuration, set PYTHON_LIBRARY to 
/sw/lib/config/libpython23.dylib (or whatever external libpython you 
have) instead of "-framework Python", and then set the corresponding 
headers and python executable path. Anyhow, in ITK 1.6, this resulted 
in moderate success.

However, with the CVS version of ITK (updated yesterday), these same 
configuration steps lead to the following python error:
%> # run the InsightToolkit import routine
%> /sw/bin/python InsightToolkit.py
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort

This error usually appears when a python extension module is loaded by 
a version of python which the module is not linked against. However, I 
explicitly set that python (and it's associated libpython) as the link 
target in ccmake (above). Moreover, for all of the obvious 
python-related libraries (i.e. bin/_*), otool -L (darwin's equivalent 
of ldd) shows the link target as the proper external python I 
specified.

So, somewhere in the bowels of some library, it appears that the python 
library link target is getting incorrectly specified. Moreover, this 
problem seems to be new in the CVS.

Zach Pincus

Department of Biochemistry and Program in Biomedical Informatics
Stanford University School of Medicine