[Numpy-discussion] F2PY error with G95 on Mac OS 10.5

Samir Unni srunni at gmail.com
Thu Jun 11 11:56:33 EDT 2009

On Wed, Jun 10, 2009 at 8:32 PM, David Cournapeau<cournape at gmail.com> wrote:
> On Thu, Jun 11, 2009 at 5:04 AM, Samir Unni<srunni at gmail.com> wrote:
>> On Wed, Jun 10, 2009 at 2:59 PM, Adam Mercer<ramercer at gmail.com> wrote:
>>> On Wed, Jun 10, 2009 at 12:44, Samir Unni<srunni at gmail.com> wrote:
>>>> I'm trying to use F2PY on Mac OS 10.5 with G95, but I'm getting the
>>>> error "g95: unrecognized option '-shared'". I tried modifying the
>>>> NumPy code to use the correct "-dynamic" flag, rather than the
>>>> "-shared" flag. While that does allow for F2PY to successfully
>>>> execute, I get the error
>>>> Traceback (most recent call last):
>>>>  File "<stdin>", line 1, in <module>
>>>> ImportError: dlopen(/Users/srunni/src/pdb2pqr/pdb2pqr/tinker/src/tinker/source/ese.so,
>>>> 2): no suitable image found.  Did find:
>>>>        /Users/srunni/src/pdb2pqr/pdb2pqr/tinker/src/tinker/source/ese.so:
>>>> unknown file type, first eight bytes: 0x80 0xC0 0x4F 0x00 0xEB 0x57
>>>> 0xE0 0x8F
>>>> when I attempt to import the generated module. Any ideas on how to fix this?
>>> AFAIK g95 is not supported by numpy distutils on Mac OS X.
> No it is not, at least not in your configuration: g95 cannot build
> universal binaries, and I think the OP error is caused by this.
> Gfortran is certainly supported.

Running diagnose.py gives me this error:

Couldn't match compiler version for 'GNU Fortran (GCC)
4.3.3\nCopyright (C) 2008 Free Software Foundation, Inc.\n\nGNU
Fortran comes with NO WARRANTY, to the extent permitted by law.\nYou
may redistribute copies of GNU Fortran\nunder the terms of the GNU
General Public License.\nFor more information about these matters, see
the file named COPYING\n'

Is this the source of the problem? I looked at
numpy/distutils/tests/test_fcompiler_gnu.py, and I found this:

gfortran_version_strings = [
    ('GNU Fortran 95 (GCC 4.0.3 20051023 (prerelease) (Debian 4.0.2-3))',
    ('GNU Fortran 95 (GCC) 4.1.0', '4.1.0'),
    ('GNU Fortran 95 (GCC) 4.2.0 20060218 (experimental)', '4.2.0'),
    ('GNU Fortran (GCC) 4.3.0 20070316 (experimental)', '4.3.0'),

My GNU Fortran version string is "GNU Fortran (GCC) 4.3.3". However,
even after adding it to that list and reinstalling, the issue



More information about the NumPy-Discussion mailing list