Re: f2py and Fortran90 gfortran_filename error



On Feb 28, 12:40 am, Robert Kern <robert.k...@xxxxxxxxx> wrote:
Tyler wrote:
Hello All:

Since my last post I have attempted to use the f2py program which
comes with numpy.

It's better to ask these questions on numpy-discussion, instead. There are more
f2py users per capita there.

http://www.scipy.org/Mailing_Lists



I am able to create a <module_name>.so file fine;
however, when I import it into Python, I receive the following
message:

import matsolve2
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: ./matsolve2.so: undefined symbol: _gfortran_filename

The steps I used to create the matsolve2.so file are as follows:

(1) Created a Fortran90 program matsolve.f90

Note: The program compiles fine and prints the proper output for the
simple matrix specified. I have also attached below the file
matsolve.f90 if it helps at all.

(2) f2py matsolve.f90 -m matsolve2 -h matsolve2.pyf
(3) f2py -c matsolve2.pyf --f90exec=/usr/bin/gfortran matsolve.f90

Note: I had to specify the f90 path as f2py did not automatically find
it.

You want to specify the *kind* of Fortran compiler such that f2py knows what
compile/link flags to use. Only use the --f90exec option to inform f2py that the
actual executable is named something odd or is in an unexpected place, like
/opt/gfortran/bin/gfortran-4.3, for example. The correct option to use is

--fcompiler=gnu95

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco


Hi Robert:

Thanks for the advice and I'll try posting to the mailing list you
mentioned. For what it's worth, the option, --fcompiler=gnu95 yileds
the following error in the second calling of f2py:

error: don't know how to compile Fortran code on platform 'posix' with
'gnu95' compiler. Supported compilers are:
compaq,absoft,intel,gnu,sun,f,vast,ibm,lahey,intelv,intele,pg,compaqv,mips,hpux,intelev,nag)

Cheers,

t.

.



Relevant Pages

  • f2py usage problem
    ... I have installed numpy and interested in testing f2py module using the ... extensions must be built with a compiler than can generate compatible ... Appending f2py.lib.parser configuration to f2py.lib ... installation and also searched the forum without finding my ...
    (comp.lang.python)
  • Re: f2py and Fortran90 gfortran_filename error
    ... f2py users per capita there. ... The program compiles fine and prints the proper output for the ... You want to specify the *kind* of Fortran compiler such that f2py knows what ... "I have come to believe that the whole world is an enigma, a harmless enigma ...
    (comp.lang.python)
  • Re: Reading Fortran Data
    ... f2py has been folded into numpy. ... Robert Kern ... "I have come to believe that the whole world is an enigma, a harmless enigma ...
    (comp.lang.python)