M***@public.gmane.org
2013-02-17 18:08:18 UTC
Hi,
I try to use f2py for the first time.
f2py.py is located under C:\Python33\Scripts.
I'm using gfortran, so I added a file distutils.cfg including the 2 lines
[build]
compiler = mingw32
to the directory C:\Python33\Lib\distutils.
The Fortran code hello.f is located under C:\Users\Mara\Desktop\PythonDoku\FortranCode and reads:
C File hello.f
subroutine foo (a)
integer a
print*, "Hello from Fortran!"
print*, "a=",a
end
I apply f2py as follows to this Fortran code:
C:\Users\Mara\Desktop\PythonDoku\FortranCode>python C:\Python33\Scripts\f2py.py
-c -m hello hello.f
This indeed produces a file hello.pyd in the folder FortranCode. For completeness here the output of the shell:
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 "hello" sources
f2py options: []
f2py:> c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3\hellomodule.c
creating c:\users\mara\appdata\local\temp\tmp7bzbwm
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3
Reading fortran codes...
Reading file 'hello.f' (format:fix,strict)
Post-processing...
Block: hello
Block: foo
Post-processing (stage 2)...
Building modules...
Building module "hello"...
Constructing wrapper function "foo"...
foo(a)
Wrote C/API module "hello" to file "c:\users\mara\appdata\local\temp\tmp
7bzbwm\src.win32-3.3\hellomodule.c"
adding 'c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3\fortranobject
.c' to sources.
adding 'c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3' to include_d
irs.
copying C:\Python33\lib\site-packages\numpy\f2py\src\fortranobject.c -> c:\users
\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3
copying C:\Python33\lib\site-packages\numpy\f2py\src\fortranobject.h -> c:\users
\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3
build_src: building npy-pkg config files
running build_ext
Cannot build msvcr library: "msvcr100d.dll" not found
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Found executable C:\MinGW\bin\gfortran.exe
Found executable C:\MinGW\bin\gfortran.exe
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
building 'hello' extension
compiling C sources
C compiler: gcc -O2 -Wall -Wstrict-prototypes
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\l
ocal
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\l
ocal\temp
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\l
ocal\temp\tmp7bzbwm
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\l
ocal\temp\tmp7bzbwm\src.win32-3.3
compile options: '-DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x1000 -Ic:\
users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3 -IC:\Python33\lib\site-pac
kages\numpy\core\include -IC:\Python33\include -IC:\Python33\include -c'
gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSIO
N__=0x1000 -Ic:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3 -IC:\Pytho
n33\lib\site-packages\numpy\core\include -IC:\Python33\include -IC:\Python33\inc
lude -c c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3\fortranobject.c
-o c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\local\
temp\tmp7bzbwm\src.win32-3.3\fortranobject.o
Found executable C:\MinGW\bin\gcc.exe
gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSIO
N__=0x1000 -Ic:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3 -IC:\Pytho
n33\lib\site-packages\numpy\core\include -IC:\Python33\include -IC:\Python33\inc
lude -c c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3\hellomodule.c -
o c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\local\te
mp\tmp7bzbwm\src.win32-3.3\hellomodule.o
compiling Fortran sources
Fortran f77 compiler: C:\MinGW\bin\gfortran.exe -Wall -ffixed-form -fno-second-u
nderscore -O3 -funroll-loops
Fortran f90 compiler: C:\MinGW\bin\gfortran.exe -Wall -fno-second-underscore -O3
-funroll-loops
Fortran fix compiler: C:\MinGW\bin\gfortran.exe -Wall -ffixed-form -fno-second-u
nderscore -Wall -fno-second-underscore -O3 -funroll-loops
compile options: '-Ic:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3 -IC
:\Python33\lib\site-packages\numpy\core\include -IC:\Python33\include -IC:\Pytho
n33\include -c'
gfortran.exe:f77: hello.f
C:\MinGW\bin\gfortran.exe -Wall -Wall -shared c:\users\mara\appdata\local\temp\t
mp7bzbwm\Release\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3\hellomodu
le.o c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\local
\temp\tmp7bzbwm\src.win32-3.3\fortranobject.o c:\users\mara\appdata\local\temp\t
mp7bzbwm\Release\hello.o -Lc:\mingw\lib\gcc\mingw32\4.5.2 -LC:\Python33\libs -LC
:\Python33\PCbuild -lpython33 -lgfortran -o .\hello.pyd
running scons
Removing build directory c:\users\mara\appdata\local\temp\tmp7bzbwm
File "<stdin>", line 1, in <module>
ImportError: No module named 'hello'
I would be glad for any help! Thank you in advance,
Mara
I try to use f2py for the first time.
f2py.py is located under C:\Python33\Scripts.
I'm using gfortran, so I added a file distutils.cfg including the 2 lines
[build]
compiler = mingw32
to the directory C:\Python33\Lib\distutils.
The Fortran code hello.f is located under C:\Users\Mara\Desktop\PythonDoku\FortranCode and reads:
C File hello.f
subroutine foo (a)
integer a
print*, "Hello from Fortran!"
print*, "a=",a
end
I apply f2py as follows to this Fortran code:
C:\Users\Mara\Desktop\PythonDoku\FortranCode>python C:\Python33\Scripts\f2py.py
-c -m hello hello.f
This indeed produces a file hello.pyd in the folder FortranCode. For completeness here the output of the shell:
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 "hello" sources
f2py options: []
f2py:> c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3\hellomodule.c
creating c:\users\mara\appdata\local\temp\tmp7bzbwm
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3
Reading fortran codes...
Reading file 'hello.f' (format:fix,strict)
Post-processing...
Block: hello
Block: foo
Post-processing (stage 2)...
Building modules...
Building module "hello"...
Constructing wrapper function "foo"...
foo(a)
Wrote C/API module "hello" to file "c:\users\mara\appdata\local\temp\tmp
7bzbwm\src.win32-3.3\hellomodule.c"
adding 'c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3\fortranobject
.c' to sources.
adding 'c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3' to include_d
irs.
copying C:\Python33\lib\site-packages\numpy\f2py\src\fortranobject.c -> c:\users
\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3
copying C:\Python33\lib\site-packages\numpy\f2py\src\fortranobject.h -> c:\users
\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3
build_src: building npy-pkg config files
running build_ext
Cannot build msvcr library: "msvcr100d.dll" not found
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Found executable C:\MinGW\bin\gfortran.exe
Found executable C:\MinGW\bin\gfortran.exe
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
building 'hello' extension
compiling C sources
C compiler: gcc -O2 -Wall -Wstrict-prototypes
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\l
ocal
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\l
ocal\temp
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\l
ocal\temp\tmp7bzbwm
creating c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\l
ocal\temp\tmp7bzbwm\src.win32-3.3
compile options: '-DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x1000 -Ic:\
users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3 -IC:\Python33\lib\site-pac
kages\numpy\core\include -IC:\Python33\include -IC:\Python33\include -c'
gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSIO
N__=0x1000 -Ic:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3 -IC:\Pytho
n33\lib\site-packages\numpy\core\include -IC:\Python33\include -IC:\Python33\inc
lude -c c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3\fortranobject.c
-o c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\local\
temp\tmp7bzbwm\src.win32-3.3\fortranobject.o
Found executable C:\MinGW\bin\gcc.exe
gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSIO
N__=0x1000 -Ic:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3 -IC:\Pytho
n33\lib\site-packages\numpy\core\include -IC:\Python33\include -IC:\Python33\inc
lude -c c:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3\hellomodule.c -
o c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\local\te
mp\tmp7bzbwm\src.win32-3.3\hellomodule.o
compiling Fortran sources
Fortran f77 compiler: C:\MinGW\bin\gfortran.exe -Wall -ffixed-form -fno-second-u
nderscore -O3 -funroll-loops
Fortran f90 compiler: C:\MinGW\bin\gfortran.exe -Wall -fno-second-underscore -O3
-funroll-loops
Fortran fix compiler: C:\MinGW\bin\gfortran.exe -Wall -ffixed-form -fno-second-u
nderscore -Wall -fno-second-underscore -O3 -funroll-loops
compile options: '-Ic:\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3 -IC
:\Python33\lib\site-packages\numpy\core\include -IC:\Python33\include -IC:\Pytho
n33\include -c'
gfortran.exe:f77: hello.f
C:\MinGW\bin\gfortran.exe -Wall -Wall -shared c:\users\mara\appdata\local\temp\t
mp7bzbwm\Release\users\mara\appdata\local\temp\tmp7bzbwm\src.win32-3.3\hellomodu
le.o c:\users\mara\appdata\local\temp\tmp7bzbwm\Release\users\mara\appdata\local
\temp\tmp7bzbwm\src.win32-3.3\fortranobject.o c:\users\mara\appdata\local\temp\t
mp7bzbwm\Release\hello.o -Lc:\mingw\lib\gcc\mingw32\4.5.2 -LC:\Python33\libs -LC
:\Python33\PCbuild -lpython33 -lgfortran -o .\hello.pyd
running scons
Removing build directory c:\users\mara\appdata\local\temp\tmp7bzbwm
import hello
Traceback (most recent call last):File "<stdin>", line 1, in <module>
ImportError: No module named 'hello'
I would be glad for any help! Thank you in advance,
Mara