[f2py] Difficulties getting f90-files to work

pearu at cens.ioc.ee pearu at cens.ioc.ee
Fri Nov 4 11:14:54 EET 2005


On Thu, 3 Nov 2005 innkeyp-ooo at yahoo.com wrote:

> Hi,
> 
> I have been trying for quite some time now to get f2py
> to work, but I can't seem to get it to work with with
> anything except the GNU compiler, which seems only to
> accept f77-files. I am new to Fortran and am more of a
> Python programmer, but need some code to run faster
> than it can with Python, so I needed to learn a new
> language. I chose Fortran, because it doesn't seem as
> mind-bending as C.
> I write my files in f95-format and usully use gFortran
> to compile. The files compile and run fine, but I
> can't get f2py to do its magic on them, because f2py
> doesn't seem to acknowledge gFortran as a viable
> compiler. It this correct?
> I have also downloaded and installed Intel's Fortran
> compiler, and although it is recognized by f2py(it
> shows up on the list of available compilers when I do
> the f2py -c --help-fcompiler command), I get the LONG
> error mesage seen below. It's quite difficult to
> grasp, but I assume I need the executables called
> 'efort' and 'efc', but I don't any files in my system
> with those names, and googling for them does not
> reveal anything..

You have ifort, that's enough.

> I really am clueless now, so any help is extremely
> appreciated.
> 
> kind regards Terri P
> 
> output:
> ***************************************************
> numpy_info:
>   FOUND:
>     define_macros = [('NUMERIC_VERSION',
> '"\\"23.8\\""')]
>     include_dirs = ['/usr/include/python2.4']
> 
> running build
> running config_fc
> running build_src
> building extension "untitled" sources
> f2py:> /tmp/tmpd1lcgf/src/untitledmodule.c
> creating /tmp/tmpd1lcgf
> creating /tmp/tmpd1lcgf/src
> Reading fortran codes...
> 	Reading file 'int_sin.f90'
> Line #33 in int_sin.f90:"real(DP), parameter ::
> interval_end   = 2.0_DP * pi"
> 	updatevars: no name pattern found for entity='*'.
> Skipping.
> Post-processing...
> 	Block: untitled
> 			Block: int_sin
> {'interval_begin': '0.0_dp'}
> In: :untitled:int_sin.f90:int_sin
> get_parameters: got "unexpected EOF while parsing
> (line 1)" on '0.0_dp'
> {'interval_end': '2.0_dp', 'interval_begin': '0.0_dp'}
> In: :untitled:int_sin.f90:int_sin
> get_parameters: got "unexpected EOF while parsing
> (line 1)" on '2.0_dp'
> {'interval_end': '2.0_dp', 'interval_begin': '0.0_dp',
> 'pi': '3.141592653589793238_dp'}
> In: :untitled:int_sin.f90:int_sin
> get_parameters: got "unexpected EOF while parsing
> (line 1)" on '3.141592653589793238_dp'

Use f2py from CVS to get rid of these errors.

> 				Block: integ_func
> Post-processing (stage 2)...
> Building modules...
> 	Building module "untitled"...
> 	Wrote C/API module "untitled" to file
> "/tmp/tmpd1lcgf/src/untitledmodule.c"
>   adding '/tmp/tmpd1lcgf/src/fortranobject.c' to
> sources.
>   adding '/tmp/tmpd1lcgf/src' to include_dirs.
> copying
> /usr/lib/python2.4/site-packages/f2py2e/src/fortranobject.c
> -> /tmp/tmpd1lcgf/src
> copying
> /usr/lib/python2.4/site-packages/f2py2e/src/fortranobject.h
> -> /tmp/tmpd1lcgf/src
> running build_ext
> customize UnixCCompiler
> customize UnixCCompiler using build_ext
> Could not locate executable efort
> Could not locate executable efc
> customize IntelFCompiler
> customize IntelFCompiler using build_ext
> building 'untitled' extension
> compiling C sources
> gcc options: '-pthread -fno-strict-aliasing -DNDEBUG
> -g -O3 -Wall -Wstrict-prototypes -fPIC'
> creating /tmp/tmpd1lcgf/tmp
> creating /tmp/tmpd1lcgf/tmp/tmpd1lcgf
> creating /tmp/tmpd1lcgf/tmp/tmpd1lcgf/src
> compile options: '-I/usr/include/python2.4
> -I/tmp/tmpd1lcgf/src -I/usr/include/python2.4 -c'
> gcc: /tmp/tmpd1lcgf/src/fortranobject.c
> gcc: /tmp/tmpd1lcgf/src/untitledmodule.c
> compiling Fortran sources
> ifort(f77) options: '-72 -w90 -w95 -KPIC -cm -O3
> -unroll'
> ifort(f90) options: '-FR -KPIC -cm -O3 -unroll'
> ifort(fix) options: '-FI -KPIC -cm -O3 -unroll'
> compile options: '-I/usr/include/python2.4
> -I/tmp/tmpd1lcgf/src -I/usr/include/python2.4 -c'
> ifort:f90: int_sin.f90
> /opt/intel/fc/9.0/bin/ifort -shared -nofor_main
> /tmp/tmpd1lcgf/tmp/tmpd1lcgf/src/untitledmodule.o
> /tmp/tmpd1lcgf/tmp/tmpd1lcgf/src/fortranobject.o
> /tmp/tmpd1lcgf/int_sin.o -o ./untitled.so
> IPO Error: unresolved : PyArg_ParseTuple
>         Referenced in
> /tmp/tmpd1lcgf/tmp/tmpd1lcgf/src/untitledmodule.o

Hmm, do you have python-dev package installed in your system? Try adding
-lpython2.3 to the linking step.

Pearu




More information about the f2py-users mailing list