f2py usage problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bkamrani@gmail.com

    f2py usage problem

    Hi Python gurus,
    I have installed numpy and interested in testing f2py module using the
    first example in the documentation.

    First I tried:

    C:\test>python "C:\Program Files\Python25\ Scripts\f2py.py " -c fib1.f
    running build
    running config_cc
    unifing config_cc, config, build_clib, build_ext, build commands --
    compiler options
    running config_fc
    unifing config_fc, config, build_clib, build_ext, build commands --
    fcompiler options
    running build_src
    building extension "untitled" sources
    f2py options: []
    f2py:c:\docume~ 1\e6462\locals~ 1\temp\tmpzcktr q
    \src.win32-2.5\untitledmod ule.c
    creating c:\docume~1\e64 62\locals~1\tem p\tmpzcktrq
    creating c:\docume~1\e64 62\locals~1\tem p\tmpzcktrq\src .win32-2.5
    Reading fortran codes...
    Reading file 'fib1.f' (format:fix,str ict)
    Post-processing...
    Block: untitled
    Block: fib
    Post-processing (stage 2)...
    Building modules...
    Building module "untitled". ..
    Constructing wrapper function "fib"...
    fib(a,[n])
    Wrote C/API module "untitled" to file "c:
    \docume~1\e6462 \locals~1\temp\ tmpzcktrq\src.w in32-2.5/
    untitledmodule. c"
    adding 'c:\docume~1\e6 462\locals~1\te mp\tmpzcktrq
    \src.win32-2.5\fortranobje ct.c' to sources.
    adding 'c:\docume~1\e6 462\locals~1\te mp\tmpzcktrq\sr c.win32-2.5' to
    include_dirs.
    copying C:\Progra~1\pyt hon25\lib\site-packages\numpy-1.0.4.0002-py2.5-
    win32.egg\
    numpy\f2py\src\ fortranobject.c -c:\docume~1\e64 62\locals~1\tem p
    \tmpzcktrq\src. win32-2.5
    copying C:\Progra~1\pyt hon25\lib\site-packages\numpy-1.0.4.0002-py2.5-
    win32.egg\
    numpy\f2py\src\ fortranobject.h -c:\docume~1\e64 62\locals~1\tem p
    \tmpzcktrq\src. win32-2.5
    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
    Warning: Assuming default configuration (C:\Program Files\Python25\ Lib
    \site-pack
    ages\numpy-1.0.4.0002-py2.5-win32.egg\numpy \f2py\lib\parse r/
    {setup_parser,s etup}.py was not found)
    Appending f2py.lib.parser configuration to f2py.lib
    Ignoring attempt to set 'name' (from 'f2py.lib' to 'f2py.lib.parse r')
    Warning: Assuming default configuration (C:\Program Files\Python25\ Lib
    \site-packages\numpy-1.0.4.0002-py2.5-win32.egg\numpy \f2py\lib\extge n/
    {setup_extgen,s etup}.py was not found)
    Appending f2py.lib.extgen configuration to f2py.lib
    Ignoring attempt to set 'name' (from 'f2py.lib' to 'f2py.lib.extge n')
    Appending f2py.lib configuration to f2py
    Ignoring attempt to set 'name' (from 'f2py' to 'f2py.lib')
    F2PY Version 2_4422
    Traceback (most recent call last):
    File "C:\Program Files\Python25\ Lib\site-packages\numpy-1.0.4.0002-
    py2.5-win32.egg\numpy \f2py\setup.py" , line 130, in <module>
    **config)
    TypeError: setup() got multiple values for keyword argument 'version'

    Version (as printed out to be "2_4422") doesn't look like to be
    multiple value as the message says...
    I have tried different machine with different python version
    installation (2.5, 2.4) and also searched the forum without finding my
    answer.

    Is there anybody out there so kind as to help me with this?
    Thanks...
    /Ben
  • Robert Kern

    #2
    Re: f2py usage problem

    bkamrani@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.


    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=mingw3 2 . 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

    Comment

    Working...