[Numpy-discussion] SOLVED: f2py "target file xxx not generated"

Thomas Ingeman-Nielsen thomas at i-n.dk
Wed Feb 16 05:00:38 EST 2011


Found a solution myself:

I tried to compile the fib1.f file directly using the gfortran compiler, and
found that indentation in the (fixed format) file was wrong. Correcting this
took care of the "target file xxx not generated" error, but still an error
resulted:

...
...
error: Unable to find vcvarsall.bat


A bit of googling pointed me to the following thread:
http://code.google.com/p/rdflib/issues/detail?id=104#c4
which suggests creating a "distutils.cfg" file.

After creating this file as described in the above reference, everything
wraps/compiles smoothly, and the fib1 subroutine is callable from Python.

Best regards,

Thomas



2011/2/16 Thomas Ingeman-Nielsen <thomas at i-n.dk>

> Hi,
>
> I'm trying to get started with f2py on a Windows 7 environment using the
> Python(x,y) v 2.6.5.6 distribution.
> I'm following the introductory example of the f2py userguide and try to
> wrap the file FIB1.F using the command:
>
> f2py.py -c fib1.f -m fib1
>
> from the windows command line. I get the following output:
>
> running build
> running config_cc
> unifing config_cc, config, build_clib, build_ext, build commands --compiler
> opti
> ons
> running config_fc
> unifing config_fc, config, build_clib, build_ext, build commands
> --fcompiler opt
> ions
> running build_src
> build_src
> building extension "fib" sources
> f2py options: []
> f2py:>
> c:\users\thomas\appdata\local\temp\tmpamyxnx\src.win32-2.6\fibmodule.c
> creating c:\users\thomas\appdata\local\temp\tmpamyxnx
> creating c:\users\thomas\appdata\local\temp\tmpamyxnx\src.win32-2.6
> Reading fortran codes...
>         Reading file 'fib1.f' (format:fix,strict)
> Post-processing...
> Post-processing (stage 2)...
> Building modules...
> error: f2py target file
> 'c:\\users\\thomas\\appdata\\local\\temp\\tmpamyxnx\\src
> .win32-2.6\\fibmodule.c' not generated
>
>
>
> output of f2py.py -c --help-fcompiler:
>
>
> Gnu95FCompiler instance properties:
>   archiver        = ['c:\\GCC451\\bin\\gfortran.exe', '-cr']
>   compile_switch  = '-c'
>   compiler_f77    = ['c:\\GCC451\\bin\\gfortran.exe', '-Wall', '-ffixed-
>                     form', '-fno-second-underscore', '-mno-cygwin', '-O3',
> '-
>                     funroll-loops']
>   compiler_f90    = ['c:\\GCC451\\bin\\gfortran.exe', '-Wall',
> '-fno-second-
>                     underscore', '-mno-cygwin', '-O3', '-funroll-loops']
>   compiler_fix    = ['c:\\GCC451\\bin\\gfortran.exe', '-Wall', '-ffixed-
>                     form', '-fno-second-underscore', '-mno-cygwin',
> '-Wall', '
>                     -fno-second-underscore', '-mno-cygwin', '-O3',
> '-funroll-
>                     loops']
>   libraries       = ['gfortran']
>   library_dirs    = ['c:\\gcc451\\lib', 'c:\\gcc451\\lib\\gcc\\i686-pc-
>                     mingw32\\4.5.1']
>   linker_exe      = ['c:\\GCC451\\bin\\gfortran.exe', '-Wall', '-mno-
>                     cygwin', '-Wall', '-mno-cygwin']
>   linker_so       = ['c:\\GCC451\\bin\\gfortran.exe', '-Wall', '-mno-
>                     cygwin', '-Wall', '-mno-cygwin', '-shared']
>   object_switch   = '-o '
>   ranlib          = ['c:\\GCC451\\bin\\gfortran.exe']
>   version         = LooseVersion ('4.5.1')
>   version_cmd     = ['c:\\GCC451\\bin\\gfortran.exe', '--version', '-mno-
>                     cygwin']
> Fortran compilers found:
>   --fcompiler=gnu95  GNU Fortran 95 compiler (4.5.1)
> Compilers available for this platform, but not found:
>   --fcompiler=absoft    Absoft Corp Fortran Compiler
>   --fcompiler=compaqv   DIGITAL or Compaq Visual Fortran Compiler
>   --fcompiler=g95       G95 Fortran Compiler
>   --fcompiler=gnu       GNU Fortran 77 compiler
>   --fcompiler=intelem   Intel Fortran Compiler for EM64T-based apps
>   --fcompiler=intelev   Intel Visual Fortran Compiler for Itanium apps
>   --fcompiler=intelv    Intel Visual Fortran Compiler for 32-bit apps
>   --fcompiler=intelvem  Intel Visual Fortran Compiler for 64-bit apps
> Compilers not available on this platform:
>   --fcompiler=compaq  Compaq Fortran Compiler
>   --fcompiler=hpux    HP Fortran 90 Compiler
>   --fcompiler=ibm     IBM XL Fortran Compiler
>   --fcompiler=intel   Intel Fortran Compiler for 32-bit apps
>   --fcompiler=intele  Intel Fortran Compiler for Itanium apps
>   --fcompiler=lahey   Lahey/Fujitsu Fortran 95 Compiler
>   --fcompiler=mips    MIPSpro Fortran Compiler
>   --fcompiler=nag     NAGWare Fortran 95 Compiler
>   --fcompiler=none    Fake Fortran compiler
>   --fcompiler=pg      Portland Group Fortran Compiler
>   --fcompiler=sun     Sun or Forte Fortran 95 Compiler
>   --fcompiler=vast    Pacific-Sierra Research Fortran 90 Compiler
> For compiler details, run 'config_fc --verbose' setup command.
>
>
>
> Running f2py without arguments result in the following version information:
>
> Version:     1
> numpy Version: 1.5.1
> Requires:    Python 2.3 or higher.
> License:     NumPy license (see LICENSE.txt in the NumPy source code)
> Copyright 1999 - 2005 Pearu Peterson all rights reserved.
> http://cens.ioc.ee/projects/f2py2e/
>
>
>
> I'm puzzled by this, I expect I have the compiler correctly installed,
> since f2py recognizes it (and I am able to compile Fortran code using GCC
> from Eclipse).
> How about the f2py version number = 1? I was under the impression that
> development had reached version >2.
>
>
> Reinstalling Numpy from SourceForge numpy-1.5.1-win32-superpack-python2.6.exe
> result in exactly the same output as above.
>
> Trying to install f2py using easy_install and then running f2py without
> arguments result in the following error:
>
> Traceback (most recent call last):
>   File "C:\Python26\Scripts\f2py.py", line 5, in <module>
>     pkg_resources.run_script('f2py==2.45.241-1926', 'f2py.py')
>   File "C:\Python26\lib\site-packages\pkg_resources.py", line 489, in
> run_script
>
>     self.require(requires)[0].run_script(script_name, ns)
>   File "C:\Python26\lib\site-packages\pkg_resources.py", line 1207, in
> run_scrip
> t
>     execfile(script_filename, namespace, namespace)
>   File
> "c:\python26\lib\site-packages\f2py-2.45.241_1926-py2.6-win32.egg\EGG-INF
> O\scripts\f2py.py", line 3, in <module>
>     import f2py2e
>   File
> "C:\Python26\lib\site-packages\f2py-2.45.241_1926-py2.6-win32.egg\f2py2e\
> __init__.py", line 10, in <module>
>     import f2py2e
>   File
> "C:\Python26\lib\site-packages\f2py-2.45.241_1926-py2.6-win32.egg\f2py2e\
> f2py2e.py", line 26, in <module>
>     import crackfortran
>   File
> "C:\Python26\lib\site-packages\f2py-2.45.241_1926-py2.6-win32.egg\f2py2e\
> crackfortran.py", line 1586
>     as=b['args']
>      ^
> SyntaxError: invalid syntax
>
>
>
> Any comments on how to adapt my setup to allow f2py to function correctly
> would be much appreciated!
>
> Best regards,
>
> Thomas
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110216/19c50b50/attachment.html>


More information about the NumPy-Discussion mailing list