I wanted to create a setup.py
file that automatically resolves a build-time dependency to numpy (for compiling extensions). My first guess was to use setu
Figured out, that a proper initialization of the numpy module is prevented by a check for __NUMPY_SETUP__
inside numpy/__init__.py
:
if __NUMPY_SETUP__:
import sys as _sys
_sys.stderr.write('Running from numpy source directory.\n')
del _sys
else:
# import subodules etc. (main branch)
This global state is not reset by setuptools after the installation. The following works:
...
def run(self):
__builtins__.__NUMPY_SETUP__ = False
import numpy
...