[Numpy-discussion] f2py links extensions to incorrect python installation on OSX / Anaconda

Robert Kern robert.kern at gmail.com
Thu Mar 27 17:02:27 EDT 2014


On Thu, Mar 27, 2014 at 8:50 PM, David Cournapeau <cournape at gmail.com> wrote:
>
> On Thu, Mar 27, 2014 at 8:30 PM, Alex Goodman <alex.goodman at colostate.edu>
> wrote:
>>
>> Hi all,
>>
>> I have used f2py in the past on a Linux machine with virtually no issues.
>> However on my Mac, I get the following error when importing an f2py
>> generated extension:
>>
>> Fatal Python error: PyThreadState_Get: no current thread
>> Abort trap: 6
>>
>> After doing some research I found out that the extension is linked to the
>> wrong python installation:
>> otool -L add.so
>> add.so:
>> ./add.so (compatibility version 0.0.0, current version 0.0.0)
>> /System/Library/Frameworks/Python.framework/Versions/2.7/Python
>> (compatibility version 2.7.0, current version 2.7.2)
>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
>> 169.3.0)
>>
>> This seems odd because I am using the f2py executable included in Anaconda
>> 1.9.1. I can easily fix this problem by manually using install_name_tool
>> -change on the extension to link the correct library location, but this is
>> really cumbersome. Is there an alternative solution, such as an additional
>> command-line argument when invoking f2py?
>
>
> This sounds like an issue specific to Anaconda, and you may get better
> support on the Anaconda support ML.

I think it's our bug. numpy.distutils adds an explicit `-framework
Python` in the Intel Fortran link line. We should be just be using
`-undefined dynamic_lookup`.

https://github.com/numpy/numpy/blob/master/numpy/distutils/fcompiler/intel.py#L71

Alex, can you edit that file to remove the '-Wl,-framework,Python'
from that list and try building again?

-- 
Robert Kern



More information about the NumPy-Discussion mailing list