[Numpy-discussion] Egg support
Robert Kern
robert.kern at gmail.com
Mon Jul 31 12:51:54 EDT 2006
Robert Crida wrote:
> Hi
>
> I am interested in building numpy using the bdist_egg option.
> Unfortunately it doesn't appear to be quite working properly. When I
> tried it with 0.9.8 then it successfully build an egg file but this had
> problems when I tried using it. I thought I would look at 1.0b1 and
> discovered that it would not build the egg at all. The problem is in
> numpy.distutils.core where it checks if "setuptools" in sys.modules. In
> my case, I have setuptools installed using ez_setup.py and hence it
> appears to be qualified by a version number and hence doesn't pass the
> test.
No, that's not the issue. You simply need to make sure that setuptools is
imported explicitly. Once it has been imported, sys.modules['setuptools'] will
exist and will be used. That's what the setupegg.py file does for you. There are
other, standard ways, too.
$ python -c "import setuptools; execfile('setup.py')" build install
Using easy_install to install numpy should work, too, since it imports
setuptools before running the setup.py script.
> I tried modifying the code to look more like an earlier option, ie
> test by trying to import setuptools within a try block and that worked
> fine. I then had a look at the trunk and discovered that the test was
> still being performed the same way, ie if "setuptools" in sys.modules,
> however there is now a setupegg.py file in the root. Now it seems that
> this is a bit of an odd workaround and I was wondering if there was any
> compelling reason for not reverting to the mechanism for testing
> availability of setuptools using a try block?
Yes. Some people have setuptools installed but do not want to install numpy as
an egg. This gives us the maximum flexibility while still making sure that
$ easy_install numpy
works.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion
mailing list