I'm pretty new to Python (~4 months) and I'm trying to use some Fortran subroutines in python but I'm having major problems using f2py. I have looked through the documentation but can't make heads or tails of why I'm getting the errors that I'm getting. I created a small Fortran file hello.f
C File hello.f
subroutine foo (a)
integer a
print*, "Hello from Fortran!"
print*, "a=",a
end
And from the command line I'm trying to use the command:
f2py -c -m hello hello.f
but I'm getting this output:
F:\home\tsansom\Projects\PyTxBLEND>f2py -c -m hello hello.f
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 "hello" sources
f2py options: []
f2py:> c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7\hellomodule.c
creating c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7
Reading fortran codes...
Reading file 'hello.f' (format:fix,strict)
Post-processing...
Block: hello
Block: foo
Post-processing (stage 2)...
Building modules...
Building module "hello"...
Constructing wrapper function "foo"...
foo(a)
Wrote C/API module "hello" to file "c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7\hellomodule.c"
adding 'c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7\fortranobject.c' to sources.
adding 'c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7' to include_dirs.
copying C:\Anaconda\lib\site-packages\numpy\f2py\src\fortranobject.c -> c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7
copying C:\Anaconda\lib\site-packages\numpy\f2py\src\fortranobject.h -> c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7
build_src: building npy-pkg config files
running build_ext
No module named msvccompiler in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
Unexpected ValueError in C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\compaq.pyc
Traceback (most recent call last):
File "C:\Anaconda\Scripts\f2py-script.py", line 23, in <module>
main()
File "C:\Anaconda\lib\site-packages\numpy\f2py\f2py2e.py", line 590, in main
run_compile()
File "C:\Anaconda\lib\site-packages\numpy\f2py\f2py2e.py", line 576, in run_compile
setup(ext_modules = [ext])
File "C:\Anaconda\lib\site-packages\numpy\distutils\core.py", line 169, in setup
return old_setup(**new_attr)
File "C:\Anaconda\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Anaconda\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Anaconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Anaconda\lib\site-packages\numpy\distutils\command\build.py", line 39, in run
old_build.run(self)
File "C:\Anaconda\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Anaconda\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Anaconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Anaconda\lib\site-packages\numpy\distutils\command\build_ext.py", line 195, in run
c_compiler=self.compiler)
File "C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\__init__.py", line 837, in new_fcompiler
load_all_fcompiler_classes()
File "C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\__init__.py", line 740, in load_all_fcompiler_classes
__import__ (module_name)
File "C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\compaq.py", line 57, in <module>
class CompaqVisualFCompiler(FCompiler):
File "C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\compaq.py", line 100, in CompaqVisualFCompiler
raise e
ValueError: [u'path', u'lib']
Anyone know what this error means? Admittedly I don't really know what I'm doing but I'm trying to learn. Thanks in advance for the help, it's much appreciated. Thanks