[Numpy-discussion] How do I ensure numpy headers are present in setup.py?

Robert Kern robert.kern@gmail....
Fri Apr 2 14:06:08 CDT 2010

On Fri, Apr 2, 2010 at 13:03, Erik Tollerud <erik.tollerud@gmail.com> wrote:
> I am writing a setup.py file for a package that will use cython with
> numpy integration.  This of course requires the numpy header files,
> which I am including by using numpy.get_includes in the setup.py file
> below.  The problem is for users that have not installed numpy before
> installing this package.    If they have setuptools installed, the
> behavior I would want would be for numpy to be downloaded and then the
> setup script should be able to get at the headers even if it doesn't
> install numpy until after this package is installed.  But that doesn't
> work - I have to import numpy in the setup script, which fails if it
> is not yet installed.  So How can I get the behavior I want?

You can't, not without some hacks to distutils. This is a basic
problem with the way setuptools uses arguments to setup() to get the

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