f2py and Fortran90 gfortran_filename error

Tyler hayes.tyler at gmail.com
Wed Feb 28 08:44:57 EST 2007


On Feb 28, 12:40 am, Robert Kern <robert.k... at gmail.com> 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.




More information about the Python-list mailing list