Python Forum
f2py: no Fortran compiler found
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
f2py: no Fortran compiler found
#1
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).
Reply
#2
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"
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
It stills not recognizing the Fortran compiler.

Thanks anyway!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to debug segfault in ctypes binding to Fortran bthomas 1 568 Sep-01-2023, 11:26 AM
Last Post: bthomas
  When does Python need to use a compiler? JanOlvegg 5 2,919 Mar-09-2023, 04:24 PM
Last Post: snippsat
  How can I found how many numbers are there in a Collatz Sequence that I found? cananb 2 2,500 Nov-23-2020, 05:15 PM
Last Post: cananb
  Compiler wallgraffiti 3 2,259 Aug-21-2020, 06:57 AM
Last Post: Gribouillis
  pip 2.7 problem with compiler aster 2 2,699 Dec-25-2019, 06:16 PM
Last Post: aster
  Fortran vs C mistert 2 2,321 Mar-07-2019, 12:55 PM
Last Post: mistert
  how do i make a compiler? lol 2 2,410 Nov-29-2018, 05:43 PM
Last Post: Larz60+
  Compiler fault or some kind of weird referencing bug? Joseph_f2 11 9,055 May-09-2017, 08:50 PM
Last Post: volcano63
  f2py recovering variables from Fortran module marius 0 3,411 Dec-02-2016, 03:52 PM
Last Post: marius
  F2PY.......plz!!!! Yuji3131 14 15,631 Oct-07-2016, 04:01 AM
Last Post: Mekire

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020