-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Cannot run setup.py build
with numpy master
#6928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
oy... yeah I know why that is there. This is going to get hairy to fix. The situation we were trying to fix for here was the whole problem where numpy is a dependency of the setup/build/install process, but it isn't installed ahead of time. So we used a trick to add numpy to the setup_requires entry of setup(), which would download and locally install numpy if numpy isn't already installed in order to have something to build against. Now, I am trying to remember exactly why the reload is needed, but I remember the whole thing being very fragile in the first place. I am going to need to search my brain for a moment. |
Looking back over that original PR, I see that part of the trick was to implement a sort of "DelayedExtension" class. I am wondering if that might be the reason for the reload? @mdboom might be able to remember. |
I should note that it wasn't PyPi that we were trying to deal with, it was the whole "needing numpy for build prior to installing" problem. This was our clever solution that we implemented 3 years ago. |
Why do you delete |
That's a pretty complicated setup script:) The whole Also |
@rgommers any pointers on docs of how to do this? It looks like we need the includes to construct the |
I think the pandas setup.py might have an appropriate incantation. On Aug 22, 2016 14:47, "Thomas A Caswell" [email protected] wrote:
|
pandas seems to do this via skimage seems to mostly use scipy seems do do the same recursive setup.py scheme as skimage, but uses sklearn looks like it has a hard numpy dependency in the setup.py The key in pandas seems to be from distutils.command.build_ext import build_ext as _build_ext
class build_ext(_build_ext):
def build_extensions(self):
numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')
for ext in self.extensions:
if hasattr(ext, 'include_dirs') and not numpy_incl in ext.include_dirs:
ext.include_dirs.append(numpy_incl)
_build_ext.build_extensions(self) which tacks the numpy onto the include_dirs of all of the extensions and then a cmd_class['build_ext'] = build_ext (pandas actually uses a further sub-class of This (presumably) gets run late enough numpy is installed and by using |
There are no good docs I'm afraid, just looking at how other packages do this. The I think for large packages the recursive |
I suspect that the path of least code-deformation here is to use the pandas It is not clear to me if what we currently have, modulo the numpy reload issues, works with just distutils (and not setuptools). At any rate, this will make it in for 2.0, I am just hoping someone does in before I get to it 😉 |
"just distutils" is irretrievably broken in general (unfortunately), e.g. you can't properly uninstall packages installed with plain distutils. So requiring setuptools is pretty reasonable these days. |
Indeed. Plus that it messes up dev version strings (messes up PEP 440), which is the issue that pushed us over the line for numpy and scipy to start having a hard dependency on |
numpy has 'fixed' this upstream numpy/numpy#7955 We probably should still fix our setup.py, but it is less urgent |
At some point, we will probably have to rework our build system, but considering numpy "fixed" this problem for us, I'll bump this to 2.1. |
Since numpy/numpy#7853 landed in master, running
python setup.py build
for matplotlib will now fail during thebuild_ext
section:It looks like the reload was introduced by 373c4d7, but I'm not sure why it's needed or if it can be worked around.
The text was updated successfully, but these errors were encountered: