lundi 13 juin 2016

F2PY cannot find intel fortran compiler on windows 7

I am struggling to get F2PY working with Intel Fortran on Windows 7. This appears to be a common issue and I have attempted a number of suggestions found in other posts (described below).

A bit of information about my system:

  • Windows 7 64-bit
  • Python 2.7.11 via Enthought Canopy 32-bit (up to date as of June 12, 2016)
  • Intel Fortran 14 (IntelComposer XE 2013 SP1) (32 and 64-bit)

After doing a bit of research see here I found that the issue may be related to the c++ runtime so I installed Microsoft Visual C++ for Python.

Still, when I attempt to build a simple test case, I receive the following error:

    D:python stuffenthought_ coursedemof2py_fcopy>f2py -c --fcompiler=intelv --c
ompiler=msvc -m fcopy fcopy.f
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 "fcopy" sources
f2py options: []
f2py:> c:usersmshippenappdatalocaltemptmpthkqugsrc.win32-2.7fcopymodule.
c
creating c:usersmshippenappdatalocaltemptmpthkqugsrc.win32-2.7
Reading fortran codes...
        Reading file 'fcopy.f' (format:fix,strict)
Post-processing...
        Block: fcopy
                        Block: fcopy
Post-processing (stage 2)...
Building modules...
        Building module "fcopy"...
                Constructing wrapper function "fcopy"...
getarrdims:warning: assumed shape array, using 0 instead of '*'
getarrdims:warning: assumed shape array, using 0 instead of '*'
                  fcopy(ain,n,aout)
        Wrote C/API module "fcopy" to file "c:usersmshippenappdatalocaltemp
tmpthkqugsrc.win32-2.7fcopymodule.c"
  adding 'c:usersmshippenappdatalocaltemptmpthkqugsrc.win32-2.7fortranob
ject.c' to sources.
  adding 'c:usersmshippenappdatalocaltemptmpthkqugsrc.win32-2.7' to inclu
de_dirs.
copying C:UsersmshippenAppDataLocalEnthoughtCanopy32Userlibsite-package
snumpyf2pysrcfortranobject.c -> c:usersmshippenappdatalocaltemptmpthkq
ugsrc.win32-2.7
copying C:UsersmshippenAppDataLocalEnthoughtCanopy32Userlibsite-package
snumpyf2pysrcfortranobject.h -> c:usersmshippenappdatalocaltemptmpthkq
ugsrc.win32-2.7
build_src: building npy-pkg config files
running build_ext
customize MSVCCompiler
customize MSVCCompiler using build_ext
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
Traceback (most recent call last):
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32UserScriptsf2py-scr
ipt.py", line 28, in <module>
    main()
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Userlibsite-package
snumpyf2pyf2py2e.py", line 648, in main
    run_compile()
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Userlibsite-package
snumpyf2pyf2py2e.py", line 633, in run_compile
    setup(ext_modules=[ext])
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Userlibsite-package
snumpydistutilscore.py", line 169, in setup
    return old_setup(**new_attr)
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Appappdatacanopy-1.
7.1.3323.win-x86libdistutilscore.py", line 151, in setup
    dist.run_commands()
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Appappdatacanopy-1.
7.1.3323.win-x86libdistutilsdist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Appappdatacanopy-1.
7.1.3323.win-x86libdistutilsdist.py", line 972, in run_command
    cmd_obj.run()
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Userlibsite-package
snumpydistutilscommandbuild.py", line 47, in run
    old_build.run(self)
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Appappdatacanopy-1.
7.1.3323.win-x86libdistutilscommandbuild.py", line 127, in run
    self.run_command(cmd_name)
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Appappdatacanopy-1.
7.1.3323.win-x86libdistutilscmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Appappdatacanopy-1.
7.1.3323.win-x86libdistutilsdist.py", line 972, in run_command
    cmd_obj.run()
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Userlibsite-package
snumpydistutilscommandbuild_ext.py", line 222, in run
    fcompiler.customize(self.distribution)
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Userlibsite-package
snumpydistutilsfcompiler__init__.py", line 464, in customize
    self.find_executables()
  File "C:UsersmshippenAppDataLocalEnthoughtCanopy32Userlibsite-package
snumpydistutilsfcompiler__init__.py", line 354, in find_executables
    raise CompilerNotFound('%s: f90 nor f77' % ctype)
numpy.distutils.fcompiler.CompilerNotFound: intelv: f90 nor f77

D:python stuffenthought_ coursedemof2py_fcopy>

Here is an output of the f2py compiler check:

D:python stuffenthought_ coursedemof2py_fcopy>ff2py -c --help-fcompiler
Fortran compilers found:
Compilers available for this platform, but not found:
  --fcompiler=absoft    Absoft Corp Fortran Compiler
  --fcompiler=compaqv   DIGITAL or Compaq Visual Fortran Compiler
  --fcompiler=g95       G95 Fortran Compiler
  --fcompiler=gnu       GNU Fortran 77 compiler
  --fcompiler=gnu95     GNU Fortran 95 compiler
  --fcompiler=intelem   Intel Fortran Compiler for 64-bit apps
  --fcompiler=intelev   Intel Visual Fortran Compiler for Itanium apps
  --fcompiler=intelv    Intel Visual Fortran Compiler for 32-bit apps
  --fcompiler=intelvem  Intel Visual Fortran Compiler for 64-bit apps
Compilers not available on this platform:
  --fcompiler=compaq   Compaq Fortran Compiler
  --fcompiler=hpux     HP Fortran 90 Compiler
  --fcompiler=ibm      IBM XL Fortran Compiler
  --fcompiler=intel    Intel Fortran Compiler for 32-bit apps
  --fcompiler=intele   Intel Fortran Compiler for Itanium apps
  --fcompiler=lahey    Lahey/Fujitsu Fortran 95 Compiler
  --fcompiler=mips     MIPSpro Fortran Compiler
  --fcompiler=nag      NAGWare Fortran 95 Compiler
  --fcompiler=none     Fake Fortran compiler
  --fcompiler=pathf95  PathScale Fortran Compiler
  --fcompiler=pg       Portland Group Fortran Compiler
  --fcompiler=sun      Sun or Forte Fortran 95 Compiler
  --fcompiler=vast     Pacific-Sierra Research Fortran 90 Compiler
For compiler details, run 'config_fc --verbose' setup command.
Removing build directory c:usersmshippenappdatalocaltemptmpiopwe2

And here are some relevant system variables:

IFORT=C:Program Files (x86)IntelComposer XE 2013 SP1
IFORT_COMPILER14=C:Program Files (x86)IntelComposer XE 2013 SP1
INTEL_DEV_REDIST=C:Program Files (x86)Common FilesIntelShared Libraries
INTEL_LICENSE_FILE=C:Program Files (x86)Common FilesIntelLicenses

Path=C:UsersmshippenAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0WinSDKBin; C:Program Files (x86)IntelComposer XE 2013 SP1bin; etc …

Some things I have tried:

  • Ran ifortvars.bat as suggested here and here
  • Tried various --fcompiler = intelv, intelvem, intel, intelem options (even though intelv should be the correct one)
  • Added the [IFORT] system variable above as a duplicate of [IFORT_COMPILER14] in case F2PY stumbled on the version specific key
  • Tried extending these paths down a level to: C:Program Files (x86)IntelComposer XE 2013 SP1binia32 (didnt work, so reverted back)

However, I get the same result. I am puzzled that despite my path and environment variable settings, the ifort.exe cannot be found. Any ideas or guidance would be much appreciated!

Thanks, Mack

Aucun commentaire:

Enregistrer un commentaire