F2PY problems

Pearu Peterson pearu at cens.ioc.ee
Sun May 5 13:49:07 EDT 2002


On 5 May 2002, Siegfried Gonzi wrote:

> Pearu Peterson wrote:
> 
> > That said, I looked at the scipy CVS and found that mingw32-support
> > needs lib2def but that is part of the weave package. So, as a quick fix,
> > get lib2def.py file from the scipy/weave directory and put it into
> > the f2py2e/scipy_distutils directory and reinstall f2py. This should solve
> > your problem, I hope.
> 
> So, this actually works but *only* then when you use something like:
> 
> f2py -c foo.f -m foo

Good.

> Everything else (setup_foo.py, Makefile) is doomed to fail!

Yes. That is the intention. Using Makefile stuff is depreciated and
setup_foo.py stuff was never finished. All compiling/building of
Fortran sources and Python extensions is managed by scipy_distutils. I
have pretty much moved all the corresponding knowledge from F2PY to
scipy_distutils by now.

> The above leads to the next question: I have not really grasped whether
> the foomodule.c file is important, because what the case if I want to
> compile a Fortran 95 file?

The foomodule.c is crucial because it implements the interface
between Fortran and Python.

> I tried it but I get the error message that gnu does not support F 90
> or F95. I saw in the "build_flib.py" file that the NAG compiler is
> supported. I thought the NAG compiler is the Fortran 95 compiler from

>From ftp://ftp.swcp.com/pub/walt/F/README:
"""
This new version is produced quite differently from
the older versions: it is a modification to the
NAG (Numerical Algorithms Group) compiler ...
"""
which I don't really understand because NAG compiler is kind a shareware
compiler... But that is NAG problem, not mine, if a problem at all.

> imagine1 (www.fortran.com/fortran/imagine1/compilers.html). But I
> think I am in error, because the build_flib.py class doe not find my
> installed F compiler (C:/.../F/bin/f.exe).

> I would strongly emphasize my wish list that some expert makes also a

:) The strength of your emphasize doesn't really matter. Both F2PY and 
SciPy are products of volunteers and one way to speed up getting support
to your needs is to volunteer yourself for testing and submitting
patches if necessary. build_flib.py contains many examples how to add
support for new compilers. Just copy, say, the NAG compiler class and
adjust it to your F compiler.  In general, it is rather simple
procedure if you know what Fortran compiler specific libraries are needed
when building the extension module.
If it works, you can send patches either to scipy-dev or f2py mailing
lists.

> support for the F compiler. The F compiler is free for Unix, Linux and
> Windows (I think there is even an older F 90 compiler for the Macintosh
> available). I am not aware of other ones but the F compiler is the only
> free available Fortran 95 compiler. 

This is not completely true: 

1) F is not really *a* Fortran 95 compiler because it can compile only a
subset of Fortran 95 standard. See the restriction list in
ftp://ftp.swcp.com/pub/walt/F/README that is much longer than the
feature list ;)

2) There are number of other F90/95 compilers that you can try out for
free and even to use for free under certain conditions:
  Absoft  - has 14day trial version for Linux
  Intel - has 30day free evaluation both for Windoza and Linux, for Linux
    they also provide noncommercial unsupported compiler with unlimited
    free usage (under certain conditions, of cource)
  Compaq - has free Enthusiast and Education licence for non-commercial
    use under Linux Alpha
  NAG - has xx day trial versions, I think
  Portland - has 15day trial version for various platforms
  etc.
In future, there will be also GNU g95 compiler available, maybe within a
year or two.

And since Windoza users have afforded to buy Windows, I am presume that 
they can afford also one of the compilers above -- they are not that
expensive.

Regards,
	Pearu






More information about the Python-list mailing list