-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Failed to build v1.17.0 on CentOS7 with default gcc (4.8) #14147
Comments
Full log attached: numpy.log |
Numpy 1.17 needs at least I think the decision was to leave passing that flag up to the distributor rather than doing it automatically, but I forget the rationale. @rgommers, were you part of that discussion? |
That sounds terrible if it's not set by default. Besides, what's the correct way to pass in compiler flags? |
See discussion in numpy/numpy#14147
Looks like on Ubuntu 18.04, gcc 7.4.0 defaults to I run |
Never mind, numpy can pick up the env correctly. But the issue remains: Do we still have the default support for CentOS 7 and its gcc 4.8.5? |
I don't know if it's related but I got a similar problem trying to install on Amazon Linux. The following work around helped me: |
@xkszltl You should pass CFLAGS="--std=c99" python3.6 -mpip wheel "numpy>=1.17,<1.18" |
@sashkab I got it resolved for me by simply using gcc-8. But should |
numpy 1.17 is also failing to build on pypy, using a ubuntu 14.04 image: https://travis-ci.org/antocuni/pypy-wheels/jobs/566563056 it seems to be that numpy should try harder to compile even on older systems, unless you have a good reason not to. |
I think passing in the std flags by default in a compiler and platform-agnostic manner can be tricky & as with many distutils things, hard to test completely. |
That rings a bell. I attempted to fix this before, and concluded there's no good place to insert the fix: #12620 (comment). This attempt has some comment as to what the problem is: rgommers@8aaf4d8 Taking a step back, the It's possible I missed a sane way to fix this. Suggestions/PRs welcome. IIRC the minimum gcc version that works for building numpy at all is 4.8. For gcc <5.1, users need to add This is a duplicate of gh-12766. |
This is biting enough people that I'll mark it for 1.17.1 - should be possible to insert a hacky fix somehow. |
Most linux distributions should have a c99 compiler script that sets the flag
@xkszltl What does that do for you? There ought to be a way we can use that on linux platforms. |
@charris And...Wow you guys already have gcc-9 ?! |
BTW it'll be better if we can find a way to inject |
Pushed this off to 1.17.2. Tempted to remove the milestone as there is a workaround and the question seems to be "is there a better way." |
Similar issue here on CentOS 7, python 3.6.3+ (configured with
|
This issue also affects RHEL and RHEL container images, pip installing numpy fails on non-intel architectures. |
Fixed in gh-14771, which added both the flag and a CI run with gcc4.8 |
The issue is reproducible on |
@sh1ng with what version of NumPy? Are you adding the -std=c99 flag? |
Without adding the flag
Adding it do solves the issue, but makes the installation process platform dependent. |
@mattip the issue occurs when miniconda is used, not a centos python package. Most likely conda's issue. |
Elham Saremi recently reported the following errors when building Numpy in numpy/core/src/npysort/radixsort.c.src: "error: 'for' loop initial declarations are only allowed in C99 or C11 mode". After some searching, I found Issue 14147[1] on Numpy's main repository about the same problem. As described there, apparently Numpy needs C99 compiler, but doesn't check for it or set it manually (for some strange reason, leaving it to the packagers to check if they want!!!). Any way, after a check with Elham, we were able to fix it by adding the `--std=c99' to CFLAGS of Numpy's build and with this commit, it is now being implemented in the core Maneage to not cause a problem in any other project. [1] numpy/numpy#14147
So, which 1.17.* version is this flag automatically set so 1.17.* build can be platform independent? I am having trouble building numpy 1.17.0 on 3.8 and 3.9 for CI jobs. |
@zoj613 did you try my suggestion above with python 3.8? It worked for me for both 1.16.x and 1.17.x on RHEL/Centos 7. |
@zoj613 It isn't automatically set in any 1.17 version, you need 1.18.0+ for that. |
Ah, Okay. @sashkab 's suggestion seems to work fine on 1.17.3 |
just to build on this, for anyone that's lost for a next step: |
Cannot build numpy v1.17.0 on CentOS 7.
Previous version works fine.
I'm seeing a lot of C99/C11 features in error message, and avx512f.
Not sure if the required
--std
option is set but I don't think gcc 4.8.5 (the system default compiler on CentOS 7) can handle all of that.Reproducing code example:
Simply build the wheel on CentOS 7 with python3.
Error message:
Some error log attached.
The entire story is too long to be pasted here.
Numpy/Python version information:
CentOS 7
Default python 3 (3.6)
Default gcc (4.8)
The text was updated successfully, but these errors were encountered: