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

Pearu Peterson pearu@cens.ioc...
Tue Sep 25 10:22:33 CDT 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)
>> ********************************************************
>> 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.
> ********************************************************
> [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

> 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.


More information about the Scipy-dev mailing list