My Python package requires numpy at build time in order to compile cython extensions. Running python setup.py install
will fail if numpy is not available in the environment.
I've read online that I can add a setup_requires
section to my setup.py
setup function call to get this working. So I've done the following:
setup(
setup_requires=[
"setuptools>=18.0",
"numpy>1.14",
],
install_requires=[
"numpy>1.14",
...
],
)
However, when I do this, my travis CI fails with
ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject
However, if I ensure that numpy is available and remove the setup_requires
section, this works.
I am confused by this behaviour, it almost seems like it's using two different versions of numpy? I can't imagine what else could cause this incompatibility.
My question is 1. why doesn't this work and 2. what, then, is the canonical way to ensure that numpy is installed when building packages.