Python Forum
f2py: no Fortran compiler found - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: f2py: no Fortran compiler found (/thread-27080.html)



f2py: no Fortran compiler found - FMJS - May-25-2020

I'm new here as well as using python. Currently I'm using Anaconda and python 3.7 and need to use some Fortran code. Found that f2py creates a shared object from the Fortran file that can be used on python scripts. When I run f2py and search for the available compilers list, no compiler is found. However, I already have the Intel Fortran compiler installed and use it through visual studio. I've read some forums and posts about similar problems but can't figure out out to solve this. I tried to define the path using: --f90exec=<path>

Still, the compiler is not found and I cannot convert the fortran files. I'm using python 3.7, on windows 10 (64 bit), and numpy version 1.18.4

When I was looking about this question, found that I must use f2py3. Does anyone know how to setup this too?

If you have any question or need more info, just ask.

Thank you for your time.

Two methods tested to solve the problem:

1st method: Using Anaconda PowerShell:

f2py -c --f90exec=<"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.1.216\windows\bin\intel64\ifort.exe">
Results:

Output:
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 "untitled" sources build_src: building npy-pkg config files running build_ext No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler customize MSVCCompiler using build_ext Removing build directory C:\Users\FILIPE~1\AppData\Local\Temp\tmp9ny0xg6b
2nd method: I also tried adding another path ("C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.1.216\windows\bin\intel64\ifort.exe") on environment variables, and rebooting (didn't work as well).


RE: f2py: no Fortran compiler found - buran - May-25-2020

I not use f2py, but looking at the docs and based on experience - you don't need to enclose path in < and >
i.e. < and > (e.g. <path>) indicate a placeholder
try
Output:
f2py -c --f90exec="C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.1.216\windows\bin\intel64\ifort.exe"



RE: f2py: no Fortran compiler found - FMJS - May-25-2020

It stills not recognizing the Fortran compiler.

Thanks anyway!