2

I am trying to implement this example of f2py, "the quick and smart way", https://numpy.org/doc/stable/f2py/f2py.getting-started.html#the-quick-and-smart-way

And get this error when I run the command:

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
build_src
building extension "fib3" sources
f2py options: []
f2py:> C:\Users\Nick\AppData\Local\Temp\tmpq7xlox0i\src.win-amd64-3.6\fib3module.c
creating C:\Users\Nick\AppData\Local\Temp\tmpq7xlox0i\src.win-amd64-3.6
IOError: [Errno 2] No such file or directory: 'fib3.f'. Skipping file "fib3.f".
Reading fortran codes...
Post-processing...
Post-processing (stage 2)...
Building modules...
error: f2py target file 'C:\\Users\\Nick\\AppData\\Local\\Temp\\tmpq7xlox0i\\src.win-amd64-3.6\\fib3module.c' not generated

Beforehand I used the MinGW installation manager for Windows from here, https://gcc.gnu.org/wiki/GFortranBinaries#Windows and installed the dev toolkit, base, fortran, g++, and msys-base packages and I don't know what is going wrong.

Thank you for any advice related to f2py.

Edit: I used the suffix .f90 instead of .f and I'm getting different errors.

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
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.

building 'fib3' extension
error: extension 'fib3' has Fortran sources but no Fortran compiler found
  • Are you able to compile Fortran sources? What happens when you execute `gfortran -v` on the command line? – Vladimir F Героям слава Jan 22 '21 at 12:19
  • @VladimirF It says it's not recognized. It could be because I have a 64 bit system. But the 64 bit binary files are different and I can't figure out how to use it. This is the 64 bit version https://sourceforge.net/projects/mingw-w64/ – happy panda Jan 22 '21 at 12:29
  • I can't find the gfortran.exe in the w64 version. – happy panda Jan 22 '21 at 12:46
  • I'm also trying cygwin to no avail. It's supposed to have a fortran compiler but it doesn't seem to be there. – happy panda Jan 22 '21 at 13:16
  • Standalone builds of MinGW-w64 from http://winlibs.com/ come with Fortran. – Brecht Sanders Jan 22 '21 at 16:03
  • Now it appears to be able to find the compiler, but importing it to python, e.g. "import fib3" doesn't work because "ImportError: DLL load failed: The specified module could not be found." I already did this (https://stackoverflow.com/a/20230455/15059070) and it didn't help. – happy panda Jan 22 '21 at 18:11

0 Answers0