[f2py] g95 on Mac OSX

Johnny Lin jlin at johnny-lin.com
Wed Jun 13 23:17:19 EEST 2007


Hi all,

I'm trying to use g95 with f2py on Mac OSX 10.4.9.  I've installed
Python 2.5 from the MacPython Universal binaries and Scipy from the
Superpack.  Version info.:

Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) 
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
G95 (GCC 4.0.3 (g95 0.91!) Jun  5 2007)
f2py Version:     2_3852
numpy Version: 1.0.4.dev3852

My PYTHONPATH is
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages.

Here's what I get when I try the basic example from the homepage:

$ f2py -c -m hello hello.f --fcompiler=g95
Traceback (most recent call last):
  File "/usr/local/bin/f2py", line 26, in <module>
    main()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/f2py/f2py2e.py", line 552, in main
    run_compile()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/f2py/f2py2e.py", line 440, in run_compile
    allowed_keys = fcompiler.fcompiler_class.keys()
AttributeError: 'NoneType' object has no attribute 'keys'

Since it appears that fcompiler_class is still set to None, I changed
fcompiler.__init__.py by making this call, to see what would happen:

   load_all_fcompiler_classes()

When I re-run, I get farther along:

$ f2py -c -m hello hello.f --fcompiler=g95
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
building extension "hello" sources
f2py options: []
f2py:> /tmp/tmp7lkYLX/src.macosx-10.3-fat-2.5/hellomodule.c
creating /tmp/tmp7lkYLX
creating /tmp/tmp7lkYLX/src.macosx-10.3-fat-2.5
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 "/tmp/tmp7lkYLX/src.macosx-10.3-fat-2.5/hellomodule.c"
  adding '/tmp/tmp7lkYLX/src.macosx-10.3-fat-2.5/fortranobject.c' to sources.
  adding '/tmp/tmp7lkYLX/src.macosx-10.3-fat-2.5' to include_dirs.
copying /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/f2py/src/fortranobject.c -> /tmp/tmp7lkYLX/src.macosx-10.3-fat-2.5
copying /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/f2py/src/fortranobject.h -> /tmp/tmp7lkYLX/src.macosx-10.3-fat-2.5
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
warning: build_ext: f77_compiler=g95 is not available.
building 'hello' extension
error: extension 'hello' has Fortran sources but no Fortran compiler found

But now I'm at a loss.  Any ideas what might be happening?

Thanks!

Best,
-Johnny
-- 

-------------------------------------------
Johnny Lin | http://www.johnny-lin.com
North Park University | Physics Department
-------------------------------------------



More information about the f2py-users mailing list