[f2py] New in the list [OT] and question about f2py/gfortran

José Pablo Fonfría jpablo.fonfria at gmail.com
Tue Jul 8 03:43:41 EEST 2008


Hi Bruno,

Thank a lot for your answer. And, of course, sorry 
because of omit all that information. I use Kubuntu 
Dapper (6.06.2), gfortran (gcc) 4.3.1, python 2.4.3 and 
f2py 2.45.241. The example code is the following one:

**************************************
module mod
   integer :: i,x(4)
   real,dimension(2,3) :: a
   real,allocatable,dimension(:,:) :: b
contains
   subroutine foo
     integer :: k
     print *,'i=',i
     print *,'x=[',x,']'
     print *,'a=['
     print *,'[',a(1,1),',',a(1,2),',',a(1,3),']'
     print *,'[',a(2,1),',',a(2,2),',',a(2,3),']'
     print *,']'
     print *,'Setting a(1,2)=a(1,2)+3'
     a(1,2)=a(1,2)+3
   end subroutine foo
end module mod
*****************************************

The error message, executing f2py -c -m mod mod.f90, is:

*****************************************
numpy_info:
   FOUND:
     define_macros = [('NUMERIC_VERSION', '"\\"24.2\\""')]
     include_dirs = ['/usr/include/python2.4']

running build
running config_fc
running build_src
building extension "mod" sources
f2py:> /tmp/tmpG0i4in/src/modmodule.c
creating /tmp/tmpG0i4in
creating /tmp/tmpG0i4in/src
Reading fortran codes...
         Reading file 'mod.f90'
Post-processing...
         Block: mod
                         Block: mod
                                 Block: foo
Post-processing (stage 2)...
         Block: mod
                 Block: unknown_interface
                         Block: mod
                                 Block: foo
Building modules...
         Building module "mod"...
                 Constructing F90 module support for 
"mod"...
                   Variables: i x b a
                         Constructing wrapper function 
"mod.foo"...
                           foo()
         Wrote C/API module "mod" to file 
"/tmp/tmpG0i4in/src/modmodule.c"
         Fortran 90 wrappers are saved to 
"/tmp/tmpG0i4in/src/mod-f2pywrappers2.f90"
   adding '/tmp/tmpG0i4in/src/fortranobject.c' to sources.
   adding '/tmp/tmpG0i4in/src' to include_dirs.
copying 
/usr/lib/python2.4/site-packages/f2py2e/src/fortranobject.c 
-> /tmp/tmpG0i4in/src
copying 
/usr/lib/python2.4/site-packages/f2py2e/src/fortranobject.h 
-> /tmp/tmpG0i4in/src
   adding '/tmp/tmpG0i4in/src/mod-f2pywrappers2.f90' to 
sources.
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize GnuFCompiler
customize GnuFCompiler
customize GnuFCompiler using build_ext
building 'mod' extension
compiling C sources
gcc options: '-pthread -fno-strict-aliasing -DNDEBUG -g 
-O3 -Wall -Wstrict-prototypes -fPIC'
creating /tmp/tmpG0i4in/tmp
creating /tmp/tmpG0i4in/tmp/tmpG0i4in
creating /tmp/tmpG0i4in/tmp/tmpG0i4in/src
compile options: '-I/usr/include/python2.4 
-I/tmp/tmpG0i4in/src -I/usr/include/python2.4 -c'
gcc: /tmp/tmpG0i4in/src/modmodule.c
gcc: /tmp/tmpG0i4in/src/fortranobject.c
XXX: module_build_dir='/tmp/tmpG0i4in/' option ignored
XXX: Fix module_dir_switch for  GnuFCompiler
XXX: module_dirs=[] option ignored
XXX: Fix module_include_switch for  GnuFCompiler
compiling Fortran 90 module sources
g77(f77) options: '-Wall -fno-second-underscore -fPIC 
-O3 -funroll-loops'
compile options: '-I/usr/include/python2.4 
-I/tmp/tmpG0i4in/src -I/usr/include/python2.4 -c'
error: f90 not supported by GnuFCompiler
********************************************************

The result of execute f2py -c --help-fcompiler is:

*********************************************************
numpy_info:
   FOUND:
     define_macros = [('NUMERIC_VERSION', '"\\"24.2\\""')]
     include_dirs = ['/usr/include/python2.4']

running build
running config_fc
customize CompaqFCompiler
customize AbsoftFCompiler
Could not locate executable efort
Could not locate executable efc
customize IntelFCompiler
customize GnuFCompiler
customize SunFCompiler
customize VastFCompiler
customize IbmFCompiler
customize LaheyFCompiler
customize IntelVisualFCompiler
customize IntelItaniumFCompiler
customize PGroupFCompiler
customize CompaqVisualFCompiler
customize MipsFCompiler
customize HPUXFCompiler
customize IntelItaniumVisualFCompiler
customize NAGFCompiler
List of available Fortran compilers:
   --fcompiler=gnu  GNU Fortran Compiler (3.4.6)
List of unavailable Fortran compilers:
   --fcompiler=absoft   Absoft Corp Fortran Compiler
   --fcompiler=compaq   Compaq Fortran Compiler
   --fcompiler=compaqv  DIGITAL|Compaq Visual 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=intelev  Intel Visual Fortran Compiler 
for Itanium apps
   --fcompiler=intelv   Intel Visual Fortran Compiler 
for 32-bit apps
   --fcompiler=lahey    Lahey/Fujitsu Fortran 95 Compiler
   --fcompiler=mips     MIPSpro Fortran Compiler
   --fcompiler=nag      NAGWare Fortran 95 Compiler
   --fcompiler=pg       Portland Group Fortran Compiler
   --fcompiler=sun      Sun|Forte Fortran 95 Compiler
   --fcompiler=vast     Pacific-Sierra Research Fortran 
90 Compiler
List of unimplemented Fortran compilers:
   --fcompiler=f  Fortran Company/NAG F Compiler
For compiler details, run 'config_fc --verbose' setup 
command.
*************************************************************************

where the availabe fortran compiler (3.4.6) is g77, 
which is installed in my system too. I installed gcc 
and gfortran 4.3.1 manually but they works fine since I 
am able to compile my fortran codes as well as before 
the upgrade.

I hope all these outputs are enough. If not, please let 
me know: I'll provide you with the information you need.

Thanks again.

Regards,

Pablo.

Bruno Fletcher escribió:
> I'm no f2py expert (just started playing around with it 2 weeks ago);
> what operating system are you trying to run f2py from? What is the
> error message that you encounter? What example code does it bomb out?
> 
> Cheers,
> Bruno Fletcher
> 
> On Mon, Jul 7, 2008 at 6:51 PM, José Pablo Fonfría
> <jpablo.fonfria at gmail.com> wrote:
>> Dear list users,
>>
>> I've just subscribed to the list and I would like to introduce myself before
>> ask you my first question about f2py.
>>
>> I've spent several years developing fortran programs, mainly in fortran77
>> although during the last half year I've tried with fortran90 with
>> satisfactory results. Last week I began to learn Python and heard about
>> f2py. I think that f2py is a very useful program and I would like to use it.
>>
>> However, while reading the user guide by Pearu Peterson and trying to
>> compile the examples, I've found a problem with the fortran90 compiler I use
>> (gfortran 4.3.1). F2py doesn't recognize it and I don't know how to add it
>> to the compilers list.
>>
>> Could anyone advise me in order to resolve this problem? I googled for
>> information and I didn't find anything useful.
>>
>> Thanks in advance.
>>
>> Regards,
>>
>> Pablo.
>>
>> _______________________________________________
>> f2py-users mailing list
>> f2py-users at cens.ioc.ee
>> http://cens.ioc.ee/mailman/listinfo/f2py-users
>>
> 




More information about the f2py-users mailing list