f2py usage problem

Robert Kern robert.kern at gmail.com
Tue Nov 11 13:54:01 EST 2008


bkamrani at gmail.com wrote:
> Hi Python gurus,
> I have installed numpy and interested in testing f2py module using the
> first example in the documentation.

Hi,

You will want to ask numpy questions on the numpy mailing list.

   http://www.scipy.org/Mailing_Lists

> First I tried:
> 
> C:\test>python "C:\Program Files\Python25\Scripts\f2py.py" -c fib1.f
...
> running build_ext
> No module named msvccompiler in numpy.distutils; trying from distutils
> error: Python was built with Visual Studio 2003;
> extensions must be built with a compiler than can generate compatible
> binaries.
> Visual Studio 2003 was not found on this system. If you have Cygwin
> installed,
> you can try compiling with MingW32, by passing "-c mingw32" to
> setup.py.
> 
> 
> Then I installed mingw32 and tried to pass "-c mingw32" to setup.py as
> below, but got another error:
> 
> 
> C:\tests>python "C:\Program Files\Python25\Lib\site-packages
> \numpy-1.0.4.0002-py2.5-win32.egg\numpy\f2py\setup.py" -c mingw32

That's not the setup.py it is talking about. f2py is used both as a program and 
a library inside your own distutils setup.py scripts. Internally, the f2py 
program uses distutils to build the extension module. The error message you see 
comes from distutils, so it is (confusingly, in this case) assuming you are 
calling distutils from a setup.py script.

The corresponding f2py program option would be --compiler=mingw32 . See "f2py 
-h" for all of the command line options.

-- 
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




More information about the Python-list mailing list