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

Pearu Peterson pearu@cens.ioc...
Tue Sep 25 02:30:40 CDT 2007


dmitrey wrote:
> hi all,
> 
> If I use in setup.py:
> 
> import setuptools
> from numpy.distutils.system_info import system_info, NotFoundError, 
> dict_append, so_ext
> 
> 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)

setuptools probably then imports distutils as the above warning
is triggered using the following condition:

   'distutils' in sys.modules

> If I use vise versa, as it is recommended:
> from numpy.distutils.system_info import system_info, NotFoundError, 
> dict_append, so_ext
> import setuptools
> Then I get:
> 
> $ sudo python setup.py install
> 
> running install
> 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_py
> running install_lib
> Traceback (most recent call last):
>   File "setup.py", line 93, in <module>
>     'Topic :: Scientific/Engineering']
>   File "/usr/lib/python2.5/site-packages/numpy/distutils/core.py", line 
> 176, in setup
>     return old_setup(**new_attr)
>   File "distutils/core.py", line 151, in setup
>   File "distutils/dist.py", line 974, in run_commands
>   File "distutils/dist.py", line 994, in run_command
>   File 
> "/usr/lib/python2.5/site-packages/numpy/distutils/command/install.py", 
> line 16, in run
>     r = old_install.run(self)
>   File "distutils/command/install.py", line 510, in run
>   File "/usr/lib/python2.5/cmd.py", line 333, in run_command
>     del help[cmd]
>   File "distutils/dist.py", line 994, in run_command
>   File 
> "/usr/lib/python2.5/site-packages/setuptools/command/install_lib.py", 
> line 21, in run
>     outfiles = self.install()
>   File "distutils/command/install_lib.py", line 116, in install
>   File 
> "/usr/lib/python2.5/site-packages/setuptools/command/install_lib.py", 
> line 47, in copy_tree
>     exclude = self.get_exclusions()
>   File 
> "/usr/lib/python2.5/site-packages/setuptools/command/install_lib.py", 
> line 30, in get_exclusions
>     if (nsp and self.get_finalized_command('install')
>   File "/usr/lib/python2.5/cmd.py", line 112, in __getattr__
>     import readline
> AttributeError: single_version_externally_managed
> 
> Do you know what does it means and how it could be fixed?

I don't know much of setuptools but may guess is that setuptools
overwrites some distutils functions/methods like numpy.distutils
does. Does setuptools say anything about the order of importing
distutils and setuptools? If not then I would call this setuptools
bug.

On systems that do not use spaces in path names the order of
importing distutils or numpy.distutils is not that important
(but in some cases importing numpy.distutils first is important).
However, for windows support the import order is crusial
(numpy.distutils fixes the paths with spaces properly).

We could make the above warning windows specific but only if
there are fundamental reasons for not fixing setuptools.

Pearu


More information about the Scipy-dev mailing list