[SciPy-dev] problems with numpy.setuptools("single_version_externally_managed")

Pearu Peterson pearu at cens.ioc.ee
Tue Sep 25 11:22:33 EDT 2007


On Tue, September 25, 2007 5:57 pm, David M. Cooke wrote:

>> I successfully install (OpenOpt) but Nils and I get the warning (with
>> latest numpy)
>> ********************************************************
>> WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!
>>
>> distutils has been imported before numpy.distutils
>> and now numpy.distutils cannot apply all of its
>> customizations to distutils effectively.
>>
>> To avoid this warning, make sure that numpy.distutils
>> is imported *before* distutils.
>> ********************************************************
>> (BTW note that distutils is not setuptools)
>
> This is because of a recent change by Pearu. This is the right way to
> do it with setuptools.
>
> Pearu: I'm going to back your change out. For one thing, this is now
> broken:
>
> $ python setupegg.py bdist_egg
> Running from numpy source directory.
> ********************************************************
> WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!
> [etc.]


This is a warning message. It does not break code.


> I *think* (and I'll fix any bugs that don't correspond to this ;-)
> that importing numpy.distutils after distutils is ok, as long as
> you're not doing anything 'odd'.

I am just trying to ensure that numpy/scipy build on all
platforms we can support. The questions is which one is
more important: to support setuptools or to make the build
work on more platforms? In the given case Windows with MS Visual
compiler.

> Basically, distutils isn't very
> robust, so it's quite hard to tell what's a bad way to mix things.
> But, we *do* explicitly support setuptools if it has been imported
> first.

Ok, then we have a problem. Details follow below.

The problem with importing distutils before numpy.distutils
is in redefining distutils.ccompiler.gen_lib_options function.

This function needs to apply our quote_args to library_dirs and
runtime_library_dirs because distutils _nt_quote_args has a bug
of not checking if directory lists have already been quoted.

So, if distutils is imported before numpy.distutils then

  distutils.ccompiler.gen_lib_options = <our gen_lib_options>

is not effective as distutils/msvccompiler.py does

  from distutils.ccompiler import gen_lib_options

so that the code in msvccompiler.py would still use the old
distutils gen_lib_options function.

Pearu




More information about the SciPy-Dev mailing list