f90wrap on Windows (Python wrapper for Fortran 90)

I've got a Python program that calls Fortran routines. These Fortran routines are wrapped with f90wrap (, and I've verified that the setup works correctly on Linux and Mac OSX. I'm now trying to get the setup to work equally well on Windows (because I collaborate with people who cannot sometimes switch to Linux).

I've got gfortran working through a MinGW installation and verified that Fortran programs compile and run without errors. I've also verified that a Python 2.7 installation works without issues, and was able to use pip to add numpy, matplotlib and scipy modules without issues. Both MinGW and Python are 64-bit, running on Windows 10. I've also got CMake to create Makefiles that compile standalone fortran programs using mingw-make, so the only part left (to get things working on Windows) is to make sure the Python wrapper for Fortran-90 works. That's where I ran into some issues.

I'm running mingw-make in Powershell (which executes in cmd.exe, I believe).

Q1: The pip installation for f90wrap failed with an absolute path/relative path error (

A1: I downloaded the source and ran "python install", and that got stuck as well. I ran into a "multiple_definition" error with Windows 10, Python 2.7 and mingw-w64.

F:/Programs/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-atonexit.o):atonexit.c:(.text+0xc0): multiple definition of atexit' F:\Programs\Python\libs/libmsvcr90.a(deoks01081.o):(.text+0x0): first defined here F:/Programs/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-mingw_helpers.o):mingw_helpers.c:(.text+0x0): multiple definition of_decode_pointer' F:\Programs\Python\libs/libmsvcr90.a(deoks00231.o):(.text+0x0): first defined here F:/Programs/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-mingw_helpers.o):mingw_helpers.c:(.text+0x10): multiple definition of `_encode_pointer' F:\Programs\Python\libs/libmsvcr90.a(deoks00241.o):(.text+0x0): first defined here collect2.exe: error: ld returned 1 exit status error: Command "gcc -g -shared build\\Release\f90wrap\arraydatamodule.o build\\Release\programs\python\lib\site-packages\numpy\f2py\src\fortranobject.o -LF:\Programs\Python\libs -LF:\Programs\Python\PCbuild\amd64 -lpython27 -lmsvcr90 -o build\\f90wrap\arraydata.pyd" failed with exit status 1


  • I got f90wrap to work on Windows 10 (64 bit, home edition) with Anaconda Python 3.8.8, numpy version 1.20.1 and f90wrap 0.2.7; gfortran through mingw-w64 (v8.1.0). I built f90wrap with python install after telling distutils.cfg to use mingw32 (and not the microsoft visual c/c++ compiler)


    2. Instructions for configuration