[Numpy-discussion] Right way to build Fortran 90 module using numpy.distutils

Juan Luis Cano juanlu001@gmail....
Tue Aug 27 06:46:36 CDT 2013

I'm having some problems to properly build a module written in Fortran
90 using numpy.distutils. It only contains one subroutine, but:

* If I write a .f90 file with the single subroutine (no module ..
contains), then f2py tries to compile it using a f77 compiler, and
that's not what I want.
* If I put it inside a module definition, then at the final
compilation stage modulef2pywrapper.c is missing the corresponding
.mod file and I have to make the build fail, then copy the .mod from
the temp directory and rebuild. Weird.

On the other hand, with the second approach f2py creates a unnecessary
level of nesting in the corresponding python module and I don't feel
quite ok with that.

What is the right way to do this? I find the documentation on
numpy.distutils a bit lacking, I almost always find the solution by
trial and error. I can push the code, it's a short file (part of the
rewrite of odeint I'm doing in SciPy).


Juan Luis Cano

More information about the NumPy-Discussion mailing list