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
BLD: Unable to build from source on Rocky Linux 8.4 with python 3.10.2 #21114
Comments
Do you have C++ installed? |
Looks like it is getting |
Is there a reason you aren't using the manylinux NumPy wheels on pipy? |
Yes, c++ is installed via the same RPM as gcc. Distutils comes native with python 3.10.2 build, Setuptools (60.9.3) and cython (0.29.28) are installed using python 3.10.2, that we build from source and then build all needed python modules also from source. The reason for doing this is we need reproducible software that we install on the clusters to support many scientific applications. Building from source and making an RPM of the build gives us the ability to easily manage software and its dependencies on hundreds of nodes. With all the same conditions that i already mentioned (gcc, setup tools, python, building machine, etc) i can build numpy 1.22.2 if i were to use an old python 3.8.0. Both python 3.8.0 and 3.10.2 are build on the same host with the same compiler and same configuration i already mentioned in original post. |
My guess is that the problem is |
I think that using distutils is a problem in conjunction with setuptools. Here are results.
I suspect something similar to what i did with setup.py needs to be done for building f2py scripts but i cant find where exactly. Here is the info that made me think about setuptools+distutils and making a patch: [root@admixdev-6 yamlspecs]# python
If i am to import setuptools and after that import distutils, then there is no warning:
I believe setuptools+distutils (or absence of setuptools?) comes into play for f2py. This is again because the 3 scripts are not generated. |
If moving the order of the two imports helps, we would welcome a PR. I build with 3.10 all the time and haven't had a problem, but I only build using |
Are you building rpms or wheels? |
I am building RPMS |
running What version of pytest are you using? The INSTALL file mentions version 1.15 but this must be a typo. Current version is 7* and even in 2010 the version was 2.0.0. |
Pytest 6.2.5. There are You might try an even earlier version of setuptools. We changed the pin from |
Darn, I've made that error more than once. It should be |
Using --user mainly installs under another dir. Still bin scripts are missing. I am certain it is an interplay of setuptools and distutils. For python 3.8.0 and setuptools v.60.9.3 there is no problem. |
Python 3.10 changed things, that is why I needed to update setuptools to 59.2.0 for my builds. I expect even more changes in 3.11.
Mine go into |
Downgrading setuptools to 49.2.0 worked, thanks for suggestion. So this was definitely distutils+setuptools. I would say a more definitive info is needed when people build from source as to what versions work and what don't. Looks like setuptools has changed a lot. Python 3.10.2 still claims distutils as deprecated but not removed. I suspect the higher version of setuptools will bring even more issues. If i knew where the creation of f2py was handled in bumpy i would attempt to play with setuptools and see if the patch can be created. There are just too many places where numpy.distutils comes into play to blindly go and change as i am not familiar with numpy code inner dependencies. |
Yep. Good to know
None of us claim to understand it either :) Changing things in |
Meson doesn't have a native facility to build rpms (neither does distutils, numpy.distutils, or setuptools). However, as a build system its main job is to compile and install -- and Meson supports all the standard mechanisms that distros expect and RPM uses. Meson even maintains the official Fedora macros file which RPM specs then use as Writing a spec file is pretty trivial. There is also https://github.com/jordansissel/fpm if you really want a built rpm and don't want to learn how to make one because your objective is to get ahold of numpy rather than submit a Fedora Maintainers application. |
I wish we could give that guidance, but we can't. Right now in
@charris each packaging format is basically some flavor of "wrap a built and installed package into some kind of container with metadata". Optionally with some things like post-processing binaries (making it relocatable, vendoring some linked dependencies for wheels, etc.). That should be separate from the build system which does all the heavy lifting. Meson will produce an installed package and the metadata about what was installed, from there the distro-specific tooling will take over. That's also how |
Thank you all for the comments. Building RPMs is not an issue. In any method of RPM building the first thing that happens is building a desired software and then packaging the result into the RPM. I am able to build numpy with setuptools 49.2.0. The question is if i update setuptools in our python installation later on to a higher version will it impact numpy? Any test you can suggest to check this? |
Same bug with python 3.10.2 and setuptools 57.5.0, rocky-linux 8.5 |
i seeing the same on debian unstable with setuptools 65.3.0 and numpy 1.23.3 (.2 built fine) and Python 3.10.7; didnt have time to read the whole thread in details yet, but just wanted to add this datapoint |
I'll just note that this is explicitly unsupported,
If that's true, that narrows things down to a few commits (see the changelog). The only one that even touches a setup.py file is gh-22215. Are you sure you are using identical environment for |
that's a bit unfortunate, as in Debian build system we dont have a choice to pick any version, only the one that's available globally in the whole distribution, and for setuptools that's 65.3.0
yeah i lied :) what i meant is that 1.23.2 built fine the last time i built, but it was not in the same environment as yday build attempt of 1.23.3. When i rebuild .2 in the same env, it fails the same. Is there any plan to support the newer setuptools and build ecosystem? at the moment, we are not able to build numpy in debian :( |
My understanding is it's become too hard to adapt to new setuptools changes, so the current build system has reached the end of the line and will effectively see no changes other than for example adding new source files. Actual improvements to the build system will be exclusively targeted at adopting Meson as a pep517 build backend, and paying any attention to setuptools at all would distract from that. |
while i sympatize with the issue of chasing a moving target (python build ecosystem), this resolution essentially prevents Debian from upgrading to 1.23.*, which may not be what the numpy project desires (given the downstream effect it may have). It looks like 1.21.5 is able to build fine with setuptools 65.3.0, if that helps identify the problem |
scratch that, 1.21.5 fails to build too |
I think it's less about the moving target and more about the fact that development-wise, it's untenable and no one knows how to fix it. A major factor here is that setuptools began forcing its distutils fork instead of the stdlib, and intentionally breaking something that is stable. Literally hoping to find out via bug reports whether anyone actually uses distutils APIs described at docs.python.org.
Debian has one option: it can package "python3-setuptools-59" and build-depend on that instead. If numpy had the resources or interest in maintaining the current build system so that Debian could avoid packaging old setuptools versions, they wouldn't need to switch build systems anyway. In fact, I seem to recall they tried, but couldn't, so the resolution is less "numpy doesn't desire to build on Debian" and more "numpy tried, failed, and gave up". On the other hand, if someone has a patch to make it work I bet they wouldn't refuse to merge it... :) |
That's pretty much it, it's untenable. This is fixable of course, but it's hard to estimate how long it will take - last time I had to tackle one of these regressions (admittedly one that was probably more hairy than this one) it took me the better part of a weekend. And that time is better spent on contributing the missing features we need to Meson and moving the whole build over on Meson. We're already going to be cutting it pretty close with being ready for Python 3.12 ...
Yes, I'll be happy to review and merge a PR.
This is actually a very reasonable solution, and less work long-term because it prevents having to deal with future regressions (which are pretty much guaranteed even if we fix this one). NumPy is also not the only package that needs a stable version of |
that's an understandable position, since python3-setuptools-59 is not really a viable solution (in Debian's context), i started having a look at what needed to be patched to make this work. I didnt go that far, so i'm wondering if you have any pointers, suggestions, maybe past PRs i can look at to try and make numpy build system compatible with setuptools 65. thanks! |
Given that the |
There is a |
we were able to build numpy/1.23.3 on Debian by exporting |
I believe this issue can be closed now. Meson is the new build system for numpy, not distutils. |
Describe the issue:
1 OS: Rocky Linux 8.4 (Green Obsidian)
2 Python: 3.10.2 built from source, configured with ./configure --prefix=/opt/apps/python/3.10.2
--enable-shared --enable- optimizations --with-lto --enable-ipv6
--enable-loadable-sqlite-extensions --without-ensurepip
3 setuptools (60.9.3) installed using python 3.10.2
4 cython (0.29.28) installed using python 3.10.2
5 BLAS, LAPACK (3.8.0) , Atlas (3.10.3) - OS provided RPMs with libs and includes in standard /usr/lib64 and /usr/include
6 gcc: OS provided RPMS version 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC)
alternate gcc: version 11.2.0 built from source.
Compiling NumPy-1.22.2 from source fails.
With all above prerequisites being the same
any build with versions ( 1.21.0, 1.21.5, 1.22.0) fails as well, not exactly the same
error as with 1.22.2 but all errors in all versions builds were of the type
AttributeError: 'UnixCCompiler' object has no attribute , for examples for NumPy 1-21.0 build:
File "/export/repositories/python-admix/yamlspecs/numpy-1.21.0/numpy/distutils/command/build_clib.py", line 106, in run
self.compiler.customize(self.distribution,
AttributeError: 'UnixCCompiler' object has no attribute 'customize'
Reproduce the code example:
Error message:
NumPy/Python version information:
The text was updated successfully, but these errors were encountered: