f2py links extensions to incorrect python installation on OSX / Anaconda
![](https://secure.gravatar.com/avatar/1ccb7a0bb89e06fc60a65ff24279dbe9.jpg?s=120&d=mm&r=g)
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? For what it is worth, I am also using Version 14.0.2 of the Intel Fortran Compiler. Thanks, Alex -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University
![](https://secure.gravatar.com/avatar/59bdb3784070f0a6836aca9ee03ad817.jpg?s=120&d=mm&r=g)
On Thu, Mar 27, 2014 at 8:30 PM, Alex Goodman <alex.goodman@colostate.edu>wrote:
This sounds like an issue specific to Anaconda, and you may get better support on the Anaconda support ML. David
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
On Thu, Mar 27, 2014 at 8:50 PM, David Cournapeau <cournape@gmail.com> wrote:
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.p... Alex, can you edit that file to remove the '-Wl,-framework,Python' from that list and try building again? -- Robert Kern
![](https://secure.gravatar.com/avatar/1ccb7a0bb89e06fc60a65ff24279dbe9.jpg?s=120&d=mm&r=g)
Hi Robert, That did the trick, thanks! Alex On Thu, Mar 27, 2014 at 3:02 PM, Robert Kern <robert.kern@gmail.com> wrote:
-- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University
![](https://secure.gravatar.com/avatar/5f88830d19f9c83e2ddfd913496c5025.jpg?s=120&d=mm&r=g)
On Thu, Mar 27, 2014 at 10:11 PM, Alex Goodman <alex.goodman@colostate.edu>wrote:
Submitted a PR for this: https://github.com/numpy/numpy/pull/4630. Thanks Robert. Ralf
![](https://secure.gravatar.com/avatar/59bdb3784070f0a6836aca9ee03ad817.jpg?s=120&d=mm&r=g)
On Thu, Mar 27, 2014 at 8:30 PM, Alex Goodman <alex.goodman@colostate.edu>wrote:
This sounds like an issue specific to Anaconda, and you may get better support on the Anaconda support ML. David
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
On Thu, Mar 27, 2014 at 8:50 PM, David Cournapeau <cournape@gmail.com> wrote:
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.p... Alex, can you edit that file to remove the '-Wl,-framework,Python' from that list and try building again? -- Robert Kern
![](https://secure.gravatar.com/avatar/1ccb7a0bb89e06fc60a65ff24279dbe9.jpg?s=120&d=mm&r=g)
Hi Robert, That did the trick, thanks! Alex On Thu, Mar 27, 2014 at 3:02 PM, Robert Kern <robert.kern@gmail.com> wrote:
-- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University
![](https://secure.gravatar.com/avatar/5f88830d19f9c83e2ddfd913496c5025.jpg?s=120&d=mm&r=g)
On Thu, Mar 27, 2014 at 10:11 PM, Alex Goodman <alex.goodman@colostate.edu>wrote:
Submitted a PR for this: https://github.com/numpy/numpy/pull/4630. Thanks Robert. Ralf
participants (4)
-
Alex Goodman
-
David Cournapeau
-
Ralf Gommers
-
Robert Kern