scipy / scipy

SciPy library main repository
https://scipy.org
BSD 3-Clause "New" or "Revised" License
13.16k stars 5.21k forks source link

Building 1.4.1 from source fails with GCC 4.4.7 #11634

Closed forced-offline closed 4 years ago

forced-offline commented 4 years ago

I'm trying to install the Python science stack from source in my work environment. I have already successfully installed numpy 1.18.1, but it does fail several tests.

I'm building from source because my Linux environment is behind the corporate firewall and has no Internet access, so I have to download packages on my Windows desktop and transfer them to the Linux machines.

Now I'm trying to install scipy but have been unsuccessful. Here are my system specs:

RHEL 6.8 GCC 4.4.7 Python 3.7.4 atlas, atlas-dev, blas, blas-dev, lapack, lapack-dev packages have all been installed

The error messages I'm seeing are related to the compiler support for c++14 or c++11:

extra options: '-std=c++14'
g++: /tmp/tmpyd_cdsfs/main.c
cc1plus: error: unrecognized command line option "-std=c++14"
C compiler: g++ -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC

...

extra options: '-std=c++11'
g++: /tmp/tmpgzl6sqc2/main.c
cc1plus: error: unrecognized command line option "-std=c++11"
Could not detect c++ standard flag
C compiler: g++ -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC

...

compile options: '-DPOCKETFFT_PTHREADS -I/home/cadmin/.local/include/python3.7m -I/apps/local/python/python-3.7.4/include/python3.7m -I/apps/local/python/python-3.7.4/x86_64/lib/python3.7/sit
e-packages/numpy-1.18.1-py3.7-linux-x86_64.egg/numpy/core/include -I/apps/local/python/python-3.7.4/include/python3.7m -I/apps/local/python/python-3.7.4/x86_64/include/python3.7m -c'
extra options: '-fvisibility=hidden'
g++: scipy/fft/_pocketfft/pypocketfft.cxx
scipy/fft/_pocketfft/pypocketfft.cxx:15:31: warning: pybind11/pybind11.h: No such file or directory
scipy/fft/_pocketfft/pypocketfft.cxx:16:28: warning: pybind11/numpy.h: No such file or directory
scipy/fft/_pocketfft/pypocketfft.cxx:17:26: warning: pybind11/stl.h: No such file or directory
In file included from scipy/fft/_pocketfft/pypocketfft.cxx:19:
scipy/fft/_pocketfft/pocketfft_hdronly.h:47:2: error: #error This file requires at least C++11 support.
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/array:35,
                 from scipy/fft/_pocketfft/pocketfft_hdronly.h:62,
                 from scipy/fft/_pocketfft/pypocketfft.cxx:19:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/c++0x_warning.h:31:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++
0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
In file included from scipy/fft/_pocketfft/pypocketfft.cxx:19:
scipy/fft/_pocketfft/pocketfft_hdronly.h:71:18: warning: atomic: No such file or directory
In file included from scipy/fft/_pocketfft/pypocketfft.cxx:19:
scipy/fft/_pocketfft/pocketfft_hdronly.h:228: warning: identifier 'decltype' will become a keyword in C++0x
scipy/fft/_pocketfft/pypocketfft.cxx:404:33: warning: missing terminating " character
scipy/fft/_pocketfft/pypocketfft.cxx:404: error: missing terminating " character
scipy/fft/_pocketfft/pypocketfft.cxx:414:4: warning: missing terminating " character
scipy/fft/_pocketfft/pypocketfft.cxx:414: error: missing terminating " character
scipy/fft/_pocketfft/pypocketfft.cxx:416:25: warning: missing terminating " character

...

error: Command "g++ -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPOCKETFFT_PTHREADS -I/home/cadmin/.local/include/python3.7m -I/apps/local/python/python-3.7.4/include/python3
.7m -I/apps/local/python/python-3.7.4/x86_64/lib/python3.7/site-packages/numpy-1.18.1-py3.7-linux-x86_64.egg/numpy/core/include -I/apps/local/python/python-3.7.4/include/python3.7m -I/apps/lo
cal/python/python-3.7.4/x86_64/include/python3.7m -c scipy/fft/_pocketfft/pypocketfft.cxx -o build/temp.linux-x86_64-3.7/scipy/fft/_pocketfft/pypocketfft.o -MMD -MF build/temp.linux-x86_64-3.
7/scipy/fft/_pocketfft/pypocketfft.o.d -fvisibility=hidden" failed with exit status 1

I can't find scipy's requirements, so I don't know if it is possible to build scipy with my current system specs and environment, although numpy was successfully built. All the errors seem to be related to pypocketfft/pocketfft, but I can barely find any information on it.

It seems the installer tried compiling with "--std=c++14" and "--std=c++11", but since both failed, I don't know if it tried with "--std=c++0x" which my compiler supports. However, there is an error message above that says

scipy/fft/_pocketfft/pocketfft_hdronly.h:47:2: error: #error This file requires at least C++11 support.

Upgrading the compiler is not possible, so what options do I have? Is it still possible to install with GCC 4.4.7? If so, how do I tell the installer to use the option "--std=c++0x"?

If not, do I need to install an older version of scipy (and if so, which version)?

Any help would be appreciated. Thanks.

miladsade96 commented 4 years ago

Hi @forced-offline You can use link below to install python packages without any internet connection and no need to build from source: https://www.ibm.com/support/knowledgecenter/el/SSWTQQ_2.0.3/install/t_si_pythonpackagesoffline.html

forced-offline commented 4 years ago

Hi @EverLookNeverSee

Thanks for your quick response. Unfortunately, that also isn't possible because while I have Internet access on my Windows machine, I can't install software on it, and it does not have Python installed now.

Also, it does seem to me that that may not resolve my current build issues, since the error messages appear to be compiler-related and I can't upgrade the compiler on the Linux machine (which is used by many other people).

Do you know if it is possible to install scipy 1.4.1 without c++14 or c++11 support? If not, what version should I install? I can't seem to find information like that anywhere ;/

Thanks.

andyfaff commented 4 years ago

You might be able to find a pre-built Linux wheel that is suitable. I think you should be able to compile from somewhere in the 1.3 release, as pocketfft was added somewhere in that time period. @peterbell10 is that correct? Lastly, you could try making a docker container with your Linux OS and compiler suite. You should have admin control over that, which means you'll be able to install a recent compiler to build scipy, then copy that over to the target machine.

forced-offline commented 4 years ago

Hi @andyfaff

Thank you for your timely response. I tried installing scipy 1.3.3 as you suggested, and it worked, but then I found that there were over 100 errors when I ran scipy.test(). All of them had a message similar to the below one:

E ImportError: /apps/local/python/python-3.7.4/x86_64/lib/python3.7/site-packages/scipy-1.3.3-py3.7-linux-x86_64.egg/scipy/linalg/_flapack.cpython-37m-x86_64-linux-gnu.so: undefined symbol: ssyconv_

I did some searching and found that someone else also on RHEL 6 had a similar problem here:

https://github.com/scipy/scipy/issues/11294

It seems that the atlas/lapack libraries are too old, and I can't change my OS, so I guess I'll need to go all the way back to scipy 1.1 :(

Anyway, that's a whole separate issue, and this one is resolved. Thank you all very much for your fast responses 👍

andyfaff commented 4 years ago

Not necessarily. I've faced the exact issues to you on an ancient cluster. I just made a ~/opt directory, with /bin, /lib, /include directories. Build and compile openblas/atlas/lapack, with a PREFIX to install into ~/opt/lib. Then make sure that opt is early on your PATH. For my particular OS I had to go back to building and installing the entire stack myself, Python/numpy/scipy/cython/zlib/openssl/etc.

forced-offline commented 4 years ago

Hi @andyfaff

That does sound interesting! I guess I could give it a try as my current Python build was already done from source, including cython/openssl/etc, and our users can access it (instead of the system's default Python) by using the modulefile approach (module load python).

So I may just need to build the atlas/lapack/(open)blas libraries into a custom directory, and push that dir to the front of PATH when "module load python" is invoked. Theoretically, this would work, wouldn't it? Thanks for the suggestion!