I'm trying to use f2py (under anaconda 2, windows 7 64bit, python 2.7.13) but I run into the following error repeatedly, even when simply trying to list available compilers:
(C:\Users\UserName\Anaconda2) C:\Users\UserName\Desktop\fortran>f2py -c --help-fco
mpiler
(C:\Users\UserName\Anaconda2) C:\Users\UserName\Desktop\fortran>call "C:\Users\UserName\
Anaconda2\Scripts\\..\python.exe" "C:\Users\UserName\Anaconda2\Scripts\\f2py
.py" -c --help-fcompiler
Unexpected ValueError in C:\Users\UserName\Anaconda2\lib\site-packages\numpy\dist
utils\fcompiler\compaq.pyc
Traceback (most recent call last):
File "C:\Users\UserName\Anaconda2\Scripts\\f2py.py", line 28, in <module>
main()
File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\f2py\f2py2e.py", line
648, in main
run_compile()
File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\f2py\f2py2e.py", line
633, in run_compile
setup(ext_modules=[ext])
File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\core.py", l
ine 169, in setup
return old_setup(**new_attr)
File "C:\Users\UserName\Anaconda2\lib\distutils\core.py", line 137, in setup
ok = dist.parse_command_line()
File "C:\Users\UserName\Anaconda2\lib\distutils\dist.py", line 467, in parse_co
mmand_line
args = self._parse_command_opts(parser, args)
File "C:\Users\UserName\Anaconda2\lib\distutils\dist.py", line 576, in _parse_c
ommand_opts
func()
File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\command\con
fig_compiler.py", line 15, in show_fortran_compilers
show_fcompilers(dist)
File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\fcompiler\_
_init__.py", line 882, in show_fcompilers
load_all_fcompiler_classes()
File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\fcompiler\_
_init__.py", line 740, in load_all_fcompiler_classes
__import__ (module_name)
File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\fcompiler\c
ompaq.py", line 57, in <module>
class CompaqVisualFCompiler(FCompiler):
File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\fcompiler\c
ompaq.py", line 100, in CompaqVisualFCompiler
raise e
ValueError: [u'path', u'include']
(C:\Users\UserName\Anaconda2) C:\Users\UserName\Desktop\fortran>
I've installed minGW for anaconda (via conda install mingw
), so it should detect and run that. I'm not too sure but it seems like it's trying to find the compaq one instead and failing at that? Here's the relevant section of compaq.py (line 100 is the final line):
if sys.platform=='win32':
from numpy.distutils.msvccompiler import MSVCCompiler
try:
m = MSVCCompiler()
m.initialize()
ar_exe = m.lib
except DistutilsPlatformError:
pass
except AttributeError:
msg = get_exception()
if '_MSVCCompiler__root' in str(msg):
print('Ignoring "%s" (I think it is msvccompiler.py bug)' % (msg))
else:
raise
except IOError:
e = get_exception()
if not "vcvarsall.bat" in str(e):
print("Unexpected IOError in", __file__)
raise e
except ValueError:
e = get_exception()
if not "path']" in str(e):
print("Unexpected ValueError in", __file__)
raise e