setup fails on mingw32

Bug #409269 reported by Alexis Roche
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NIPY
Fix Committed
Undecided
Unassigned

Bug Description

Since my last pull (revision 1772), "python setup.py config" fails on my mingw32 system with an AttributeError: 'str' object has no attribute 'extend' (see Traceback below). This seems to result from a modification in a recent revision because revision 1770 was building fine with the same configuration, specifically:
- MinGW 5.1.4
- Python 2.5
- Numpy 3.0
- Scipy 0.7.1

Note that the same error occurs when substituting stable numpy and scipy releases with the latest development versions (numpy 1.4.0 dev 7282 and scipy 0.8.0 dev 5891).

 Traceback (most recent call last):
  File "setup.py", line 107, in <module>
    main(**extra_setuptools_args)
  File "setup.py", line 103, in main
    **extra_args)
  File "c:\Python25\Lib\site-packages\numpy\distutils\core.py", line 152, in setup
    config = configuration()
  File "setup.py", line 22, in configuration
    config.add_subpackage('nipy', 'nipy')
  File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 890, in add_subpackage
    caller_level = 2)
  File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 859, in get_subpackage
    caller_level = caller_level + 1)
  File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 796, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "nipy\setup.py", line 61, in configuration
    nipy_info().set_info(**get_nipy_info())
  File "c:\Python25\Lib\site-packages\numpy\distutils\system_info.py", line 433, in set_info
    dict_append(info,**lib_info)
  File "c:\Python25\Lib\site-packages\numpy\distutils\system_info.py", line 1945, in dict_append
    d[k].extend(v)
AttributeError: 'str' object has no attribute 'extend'

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote : Re: [Bug 409269] [NEW] setup fails on mingw32

On Wed, Aug 05, 2009 at 11:24:50AM -0000, Alexis Roche wrote:

> Traceback (most recent call last):
> File "setup.py", line 107, in <module>
> main(**extra_setuptools_args)
> File "setup.py", line 103, in main
> **extra_args)
> File "c:\Python25\Lib\site-packages\numpy\distutils\core.py", line 152, in setup
> config = configuration()
> File "setup.py", line 22, in configuration
> config.add_subpackage('nipy', 'nipy')
> File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 890, in add_subpackage
> caller_level = 2)
> File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 859, in get_subpackage
> caller_level = caller_level + 1)
> File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 796, in _get_configuration_from_setup_py
> config = setup_module.configuration(*args)
> File "nipy\setup.py", line 61, in configuration
> nipy_info().set_info(**get_nipy_info())
> File "c:\Python25\Lib\site-packages\numpy\distutils\system_info.py", line 433, in set_info
> dict_append(info,**lib_info)
> File "c:\Python25\Lib\site-packages\numpy\distutils\system_info.py", line 1945, in dict_append
> d[k].extend(v)
> AttributeError: 'str' object has no attribute 'extend'

Interesting, I cannot reproduce. You are talking about the neurospin
branch, right?

Could you run 'python -m pdb setup.py config' to introspect (enter
'continue' at the first promp) and print the value of d, k and v when
this fails.

Cheers,

Gaël

Revision history for this message
Alexis Roche (alexis-roche) wrote :
Download full text (4.3 KiB)

Hi Gaël,

> Interesting, I cannot reproduce. You are talking about the neurospin
> branch, right?

I am talking about the main branch, but I actually get the same bug
with the neurospin branch.

> Could you run 'python -m pdb setup.py config' to introspect (enter
> 'continue' at the first promp) and print the value of d, k and v when
> this fails.

I get:

(Pdb) d
*** Newest frame
(Pdb) k
'libraries'
(Pdb) v
['g2c']
(Pdb)

Here is the complete log:

Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\home\AR203069\bzr\nipy\nipy>python -m pdb setup.py config
> d:\home\ar203069\bzr\nipy\nipy\setup.py(2)<module>()
-> import sys
(Pdb) continue
nipy\__init__.py:71: UserWarning: Running the tests from the install directory m
ay trigger some failures
  warnings.warn('Running the tests from the install directory may '
lapack_opt_info:
lapack_mkl_info:
mkl_info:
  libraries mkl,vml,guide not found in c:\mingw\lib
  libraries mkl,vml,guide not found in c:\Libraries\lib
  NOT AVAILABLE

  NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS
  libraries ptf77blas,ptcblas,atlas not found in c:\mingw\lib
  libraries lapack_atlas not found in c:\mingw\lib
  libraries ptf77blas,ptcblas,atlas not found in c:\Libraries\lib
  libraries lapack_atlas not found in c:\Libraries\lib
numpy.distutils.system_info.atlas_threads_info
  NOT AVAILABLE

atlas_info:
  libraries f77blas,cblas,atlas not found in c:\mingw\lib
  libraries lapack_atlas not found in c:\mingw\lib
  libraries f77blas,cblas,atlas not found in c:\Libraries\lib
  libraries lapack_atlas not found in c:\Libraries\lib
numpy.distutils.system_info.atlas_info
  NOT AVAILABLE

C:\Python25\lib\site-packages\numpy\distutils\system_info.py:1295: UserWarning:

    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  warnings.warn(AtlasNotFoundError.__doc__)
lapack_info:
  libraries lapack not found in c:\mingw\lib
  FOUND:
    libraries = ['lapack', 'g2c']
    library_dirs = ['c:\\Libraries\\lib', 'c:\\mingw\\lib']
    language = f77

blas_info:
  libraries blas not found in c:\mingw\lib
  FOUND:
    libraries = ['blas', 'g2c']
    library_dirs = ['c:\\Libraries\\lib', 'c:\\mingw\\lib']
    language = f77

  FOUND:
    libraries = ['lapack', 'g2c', 'blas', 'g2c', 'g2c']
    library_dirs = ['c:\\Libraries\\lib', 'c:\\mingw\\lib']
    define_macros = [('NO_ATLAS_INFO', 1)]
    language = f77

Traceback (most recent call last):
  File "C:\Python25\lib\pdb.py", line 1213, in main
    pdb._runscript(mainpyfile)
  File "C:\Python25\lib\pdb.py", line 1138, in _runscript
    self.run(statement, globals=globals_, locals=locals_)
  File "C:\Python25\lib\bdb.py", line 366, in run
    exec cmd in globals, locals
  File "<string>", line 1, in <module>
  File "setup.py", line 107, in <module>
    main(**extra_setuptools_args)
  File "setup.py", line 103, in main
    **extra_args)
  File "c:\Python25\Lib\site-packages\numpy\distutils\core.py", line 152, in set
up
    config = configuration()
  File "setup.py", li...

Read more...

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

On Wed, Aug 05, 2009 at 03:54:28PM -0000, Alexis Roche wrote:
> (Pdb) d
> *** Newest frame
> (Pdb) k
> 'libraries'
> (Pdb) v
> ['g2c']
> (Pdb)

Use "print d" in pdb, "d" is mapped to a pdb command.

Gaël

Revision history for this message
Alexis Roche (alexis-roche) wrote :

> Use "print d" in pdb, "d" is mapped to a pdb command.

All right.

(Pdb) print d
{'libraries': 'g2c', 'library_dirs':
'c:\\mingw\\lib;c:\\Libraries\\lib', 'include_dirs':
'c:\\mingw\\include;c:\\Libraries\\include'}

Cheers,

Alexis

Revision history for this message
Alexis Roche (alexis-roche) wrote :

Sounds like numpy.distutils expects d['libraries'] to be a list, while
it's a string with value 'g2c'...

Here below is the site.cfg file I use to build numpy (I have been
using it for almost two years):

[DEFAULT]
library_dirs = c:\mingw\lib;c:\Libraries\lib
include_dirs = c:\mingw\include;c:\Libraries\include
libraries = g2c

Last thing: I'm using g77 as a fortran compiler (it is the one
provided by mingw).

Alexis

On Wed, Aug 5, 2009 at 6:48 PM, Alexis Roche<email address hidden> wrote:
>> Use "print d" in pdb, "d" is mapped to a pdb command.
>
> All right.
>
> (Pdb) print d
> {'libraries': 'g2c', 'library_dirs':
> 'c:\\mingw\\lib;c:\\Libraries\\lib', 'include_dirs':
> 'c:\\mingw\\include;c:\\Libraries\\include'}
>
> Cheers,
>
> Alexis
>

--
Alexis Roche, PhD
Researcher, CEA, Neurospin, Paris, France
Academic Guest, ETHZ, Computer Vision Lab, Zurich, Switzerland
http://alexis.roche.googlepages.com

Revision history for this message
Matthew Brett (matthew-brett) wrote :

Hi,

> [DEFAULT]
> library_dirs = c:\mingw\lib;c:\Libraries\lib
> include_dirs = c:\mingw\include;c:\Libraries\include
> libraries = g2c

I think the libraries have to be a 'comma-separated list of library
names' (from the numpy site.cfg.example file).

I'm guessing that

libraries = g2c,

will work - does it?

See you,

Matthew

Revision history for this message
Alexis Roche (alexis-roche) wrote :

> I'm guessing that
>
> libraries = g2c,
>
> will work - does it?

It doesn't work with

libraries = g2c,

But it does work with

libraries = [g2c]

In the former case, the value of d['libraries'] is still a string
equal to 'g2c,'

Many thanks! The 100$ question is then: why was it working before?

Cheers,

Alexis

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

On Wed, Aug 05, 2009 at 05:52:39PM -0000, Alexis Roche wrote:
> But it does work with

> libraries = [g2c]

> In the former case, the value of d['libraries'] is still a string
> equal to 'g2c,'

> Many thanks! The 100$ question is then: why was it working before?

I am really puzzled. Do you have any clue what you changed. I don't think
anything changed on the nipy side. Also, what is the site.cfg that you
use to build numpy?

Gaël

Revision history for this message
Alexis Roche (alexis-roche) wrote :

> I am really puzzled. Do you have any clue what you changed. I don't think
> anything changed on the nipy side. Also, what is the site.cfg that you
> use to build numpy?

The thing is, I didn't change anything! The site.cfg I provided is
exactly the same as the one I have been using for months to build
numpy -- by the way, the latest numpy svn version builds perfectly
with it.

I am puzzled too. My only explanation is that something must have
changed on the nipy side that causes an unexpected interaction with
numpy.distutils. I think this is a bug because nipy should tolerate
any site.cfg file that gets numpy to build (very often, the site.cfg
used by nipy will be the one lying in site-packages/numpy/distutils).

Best,

Alexis

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

On Wed, Aug 05, 2009 at 07:41:02PM -0000, Alexis Roche wrote:
> I am puzzled too. My only explanation is that something must have
> changed on the nipy side that causes an unexpected interaction with
> numpy.distutils. I think this is a bug because nipy should tolerate
> any site.cfg file that gets numpy to build (very often, the site.cfg
> used by nipy will be the one lying in site-packages/numpy/distutils).

Well, we have version control, so you can bisect to find the change that
triggered this behavior. That way we can isolate the problem and fix it.

Gaël

Revision history for this message
Alexis Roche (alexis-roche) wrote :

The problem appears as of revision 1768. Revision 1767 is the last one
to build with my old site.cfg file.

Revision 1768 affected several setup files including setup.py and
nipy/setup.py. Any ideas? I'll have a look tomorrow.

Alexis

Revision history for this message
Alexis Roche (alexis-roche) wrote :

I just pushed a quick fix in nipy/setup.py that basically forces the
dictionary returned by the get_nipy_info function to have a list as a
value for key 'libraries'. That code should be reviewed by a config
parsing expert, which I am not.

Cheers,

Alexis

On Thu, Aug 6, 2009 at 2:03 AM, Alexis Roche<email address hidden> wrote:
> The problem appears as of revision 1768. Revision 1767 is the last one
> to build with my old site.cfg file.
>
> Revision 1768 affected several setup files including setup.py and
> nipy/setup.py. Any ideas? I'll have a look tomorrow.
>
> Alexis
>

--
Alexis Roche, PhD
Researcher, CEA, Neurospin, Paris, France
Academic Guest, ETHZ, Computer Vision Lab, Zurich, Switzerland
http://alexis.roche.googlepages.com

Revision history for this message
Matthew Brett (matthew-brett) wrote :

Hi,

On Wed, Aug 5, 2009 at 5:03 PM, Alexis Roche<email address hidden> wrote:
> The problem appears as of revision 1768. Revision 1767 is the last one
> to build with my old site.cfg file.
>
> Revision 1768 affected several setup files including setup.py and
> nipy/setup.py. Any ideas? I'll have a look tomorrow.

Does your committed fix work? It looks like it should result in ['g',
'2', 'c'] for a string 'g2c'.

Do you mean:

if libraries in info and isinstance(info['libraries'], basestring):
    info['libraries'] = [info['libraries']]

See you,

Matthew

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

On Thu, Aug 06, 2009 at 12:03:34AM -0000, Alexis Roche wrote:
> The problem appears as of revision 1768. Revision 1767 is the last one
> to build with my old site.cfg file.

> Revision 1768 affected several setup files including setup.py and
> nipy/setup.py. Any ideas? I'll have a look tomorrow.

Very useful, thanks for bisecting. I can't look at this right now, but if
nobody finds the time before me, I'll look at it tonight, or tomorrow.

Gaël

Revision history for this message
Alexis Roche (alexis-roche) wrote :

Well, my fix was working (probably because it had no effect beside
bypassing the bug). But, you're right, it was rubbish. I just
substituted with yours.

You mean:

if 'libraries' in info

rather than:

if libraries in info

Don't you?

Alexis

On Thu, Aug 6, 2009 at 2:53 AM, Matthew Brett<email address hidden> wrote:
> Hi,
>
> On Wed, Aug 5, 2009 at 5:03 PM, Alexis Roche<email address hidden> wrote:
>> The problem appears as of revision 1768. Revision 1767 is the last one
>> to build with my old site.cfg file.
>>
>> Revision 1768 affected several setup files including setup.py and
>> nipy/setup.py. Any ideas? I'll have a look tomorrow.
>
> Does your committed fix work?  It looks like it should result in ['g',
> '2', 'c'] for a string 'g2c'.
>
> Do you mean:
>
> if libraries in info and isinstance(info['libraries'], basestring):
>    info['libraries'] = [info['libraries']]
>
> See you,
>
> Matthew
>
> --
> setup fails on mingw32
> https://bugs.launchpad.net/bugs/409269
> You received this bug notification because you are a member of nipy-
> developers, which is the registrant for NIPY.
>
> Status in Neuroimaging in Python: New
>
> Bug description:
> Since my last pull (revision 1772), "python setup.py config" fails on my mingw32 system with an AttributeError: 'str' object has no attribute 'extend' (see Traceback below). This seems to result from a modification in a recent revision because revision 1770 was building fine with the same configuration, specifically:
> - MinGW 5.1.4
> - Python 2.5
> - Numpy 3.0
> - Scipy 0.7.1
>
> Note that the same error occurs when substituting stable numpy and scipy releases with the latest development versions (numpy 1.4.0 dev 7282 and scipy 0.8.0 dev 5891).
>
>
>  Traceback (most recent call last):
>  File "setup.py", line 107, in <module>
>    main(**extra_setuptools_args)
>  File "setup.py", line 103, in main
>    **extra_args)
>  File "c:\Python25\Lib\site-packages\numpy\distutils\core.py", line 152, in setup
>    config = configuration()
>  File "setup.py", line 22, in configuration
>    config.add_subpackage('nipy', 'nipy')
>  File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 890, in add_subpackage
>    caller_level = 2)
>  File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 859, in get_subpackage
>    caller_level = caller_level + 1)
>  File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 796, in _get_configuration_from_setup_py
>    config = setup_module.configuration(*args)
>  File "nipy\setup.py", line 61, in configuration
>    nipy_info().set_info(**get_nipy_info())
>  File "c:\Python25\Lib\site-packages\numpy\distutils\system_info.py", line 433, in set_info
>    dict_append(info,**lib_info)
>  File "c:\Python25\Lib\site-packages\numpy\distutils\system_info.py", line 1945, in dict_append
>    d[k].extend(v)
> AttributeError: 'str' object has no attribute 'extend'
>

--
Alexis Roche, PhD
Researcher, CEA, Neurospin, Paris, France
Academic Guest, ETHZ, Computer Vision Lab, Zurich, Switzerland
http://alexis.roche.googlepages.com

Revision history for this message
Matthew Brett (matthew-brett) wrote :

> if 'libraries' in info
>
> rather than:
>
> if libraries in info
>
> Don't you?

I did - thanks for spotting that...

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

Alexis,

It seems to me that this bug can be closed (by looking at the code).

Could you confirm it, please?

And thanks to everyone for the very efficient maner in which the problem
was processed.

Gaël

Revision history for this message
Alexis Roche (alexis-roche) wrote :

The bug can be closed, as far as I am concerned.

Alexis

On Sat, Aug 8, 2009 at 12:47 PM, Gael
Varoquaux<email address hidden> wrote:
> Alexis,
>
> It seems to me that this bug can be closed (by looking at the code).
>
> Could you confirm it, please?
>
> And thanks to everyone for the very efficient maner in which the problem
> was processed.
>
> Gaël
>
> --
> setup fails on mingw32
> https://bugs.launchpad.net/bugs/409269
> You received this bug notification because you are a member of nipy-
> developers, which is the registrant for NIPY.
>
> Status in Neuroimaging in Python: New
>
> Bug description:
> Since my last pull (revision 1772), "python setup.py config" fails on my mingw32 system with an AttributeError: 'str' object has no attribute 'extend' (see Traceback below). This seems to result from a modification in a recent revision because revision 1770 was building fine with the same configuration, specifically:
> - MinGW 5.1.4
> - Python 2.5
> - Numpy 3.0
> - Scipy 0.7.1
>
> Note that the same error occurs when substituting stable numpy and scipy releases with the latest development versions (numpy 1.4.0 dev 7282 and scipy 0.8.0 dev 5891).
>
>
>  Traceback (most recent call last):
>  File "setup.py", line 107, in <module>
>    main(**extra_setuptools_args)
>  File "setup.py", line 103, in main
>    **extra_args)
>  File "c:\Python25\Lib\site-packages\numpy\distutils\core.py", line 152, in setup
>    config = configuration()
>  File "setup.py", line 22, in configuration
>    config.add_subpackage('nipy', 'nipy')
>  File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 890, in add_subpackage
>    caller_level = 2)
>  File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 859, in get_subpackage
>    caller_level = caller_level + 1)
>  File "c:\Python25\Lib\site-packages\numpy\distutils\misc_util.py", line 796, in _get_configuration_from_setup_py
>    config = setup_module.configuration(*args)
>  File "nipy\setup.py", line 61, in configuration
>    nipy_info().set_info(**get_nipy_info())
>  File "c:\Python25\Lib\site-packages\numpy\distutils\system_info.py", line 433, in set_info
>    dict_append(info,**lib_info)
>  File "c:\Python25\Lib\site-packages\numpy\distutils\system_info.py", line 1945, in dict_append
>    d[k].extend(v)
> AttributeError: 'str' object has no attribute 'extend'
>

--
Alexis Roche, PhD
Researcher, CEA, Neurospin, Paris, France
Academic Guest, ETHZ, Computer Vision Lab, Zurich, Switzerland
http://alexis.roche.googlepages.com

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

On Sat, Aug 08, 2009 at 11:48:01AM -0000, Alexis Roche wrote:
> The bug can be closed, as far as I am concerned.

Excellent. That's what I thought. Thanks for the very professional way
this was handled.

Gaël

Changed in nipy:
status: New → Fix Committed
Revision history for this message
Matthew Brett (matthew-brett) wrote :

> Excellent. That's what I thought. Thanks for the very professional way
> this was handled.

For me, 'professional' has the meaning of "boring, impersonal,
careful, fitting-in, doing what you're told, keeping the machine
going", and has no positive meaning at all.

I only mention that because I think what you meant was 'I would like
things to be more like this thing that just happened' - and attaching
'professional' to that, makes it seem rather ugly in my space of
desirability.

luv,

Matthew

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.