[Numpy-discussion] Fortran 95 compiler (from gcc 4.1.1) is not recognized by scipy

Darren Dale dd55 at cornell.edu
Thu Jun 8 09:43:07 EDT 2006


On Thursday 01 June 2006 12:46, Robert Kern wrote:
> Nadav Horesh wrote:
> > I recently upgraded to gcc4.1.1. When I tried to compile scipy from
> > today's svn repository it halts with the following message:
> >
> > Traceback (most recent call last):
> >   File "setup.py", line 50, in ?
> >     setup_package()
> >   File "setup.py", line 42, in setup_package
> >     configuration=configuration )
> >   File "/usr/lib/python2.4/site-packages/numpy/distutils/core.py", line
> > 170, in setup
> >     return old_setup(**new_attr)
> >   File "/usr/lib/python2.4/distutils/core.py", line 149, in setup
> >     dist.run_commands()
> >   File "/usr/lib/python2.4/distutils/dist.py", line 946, in run_commands
> >     self.run_command(cmd)
> >   File "/usr/lib/python2.4/distutils/dist.py", line 966, in run_command
> >     cmd_obj.run()
> >   File "/usr/lib/python2.4/distutils/command/build.py", line 112, in run
> >     self.run_command(cmd_name)
> >   File "/usr/lib/python2.4/distutils/cmd.py", line 333, in run_command
> >     self.distribution.run_command(command)
> >   File "/usr/lib/python2.4/distutils/dist.py", line 966, in run_command
> >     cmd_obj.run()
> >   File
> > "/usr/lib/python2.4/site-packages/numpy/distutils/command/build_ext.py",
> > line 109, in run
> >     self.build_extensions()
> >   File "/usr/lib/python2.4/distutils/command/build_ext.py", line 405, in
> > build_e xtensions
> >     self.build_extension(ext)
> >   File
> > "/usr/lib/python2.4/site-packages/numpy/distutils/command/build_ext.py",
> > line 301, in build_extension
> >     link = self.fcompiler.link_shared_object
> > AttributeError: 'NoneType' object has no attribute 'link_shared_object'
> >
> > ----
> >
> > The output of gfortran --version:
> >
> > GNU Fortran 95 (GCC) 4.1.1 (Gentoo 4.1.1)
>
> Hmm. The usual suspect (not finding the version) doesn't seem to be the
> problem here.
>
> >>> from numpy.distutils.ccompiler import simple_version_match
> >>> m = simple_version_match(start='GNU Fortran 95')
> >>> m(None, 'GNU Fortran 95 (GCC) 4.1.1 (Gentoo 4.1.1)')
>
> '4.1.1'
>
> > I have also the old g77 compiler installed (g77-3.4.6). Is there a way to
> > force numpy/scipy to use it?
>
> Sure.
>
> python setup.py config_fc --fcompiler=gnu build_src build_clib build_ext
> build

I am able to build numpy/scipy on a 64bit Athlon with gentoo and gcc-4.1.1. I 
get one error with scipy 0.5.0.1940:
==============================================
FAIL: check_random_complex_overdet (scipy.linalg.tests.test_basic.test_lstsq)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.4/site-packages/scipy/linalg/tests/test_basic.py", 
line 413, in check_random_complex_overdet
    assert_array_almost_equal(x,direct_lstsq(a,b),3)
  File "/usr/lib64/python2.4/site-packages/numpy/testing/utils.py", line 233, 
in assert_array_almost_equal
    assert cond,\
AssertionError:
Arrays are not almost equal (mismatch 77.7777777778%):
        Array 1: [[-0.0137+0.0173j  0.0037-0.0173j -0.0114+0.0119j]
 [ 0.0029-0.0356j  0.0086-0.034j   0.033 -0.0879j]
 [ 0.0041-0.0097j ...
        Array 2: [[-0.016 +0.0162j  0.003 -0.0171j -0.0148+0.009j ]
 [-0.0017-0.0405j  0.003 -0.036j   0.0256-0.0977j]
 [ 0.0038-0.0112j ...


----------------------------------------------------------------------

Also, there may be a minor bug in numpy/distutils. I get error messages during 
the build:

customize GnuFCompiler
Couldn't match compiler version for 'GNU Fortran 95 (GCC) 4.1.1 (Gentoo 
4.1.1)\nCopyright (C) 2006 Free Software Foundation, Inc.\n\nGNU Fortran 
comes with NO WARRANTY, to the extent permitted by law.\nYou may redistribute 
copies of GNU Fortran\nunder the terms of the GNU General Public License.
\nFor more information about these matters, see the file named COPYING\n'
customize CompaqFCompiler
customize IntelItaniumFCompiler
customize IntelEM64TFCompiler
customize Gnu95FCompiler
customize Gnu95FCompiler

This error message is returned because the fc_exe executable defined in 
GnuFCompiler returns a successful exit status to GnuFCompiler.get_version, 
but GnuFCompiler explicitly forbids identifying Fortran 95. I only bring it 
up because the build yields an error message that might confuse people.

Darren





More information about the NumPy-Discussion mailing list