gcc compilation problem on pip install
Closed this issue · 12 comments
Hello
I'm struggling with the 'pip install' approach to getting pysteps installed on my Mac (OS Mojave 10.14.2). I've tried:
pip install numpy
(which was successful)
pip install git+https://github.com/pySTEPS/pysteps
after progressing some way, it fails with the following message:
:
:
creating build/temp.macosx-10.9-x86_64-3.7/pysteps/motion
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c pysteps/motion/_vet.c -o build/temp.macosx-10.9-x86_64-3.7/pysteps/motion/_vet.o -fopenmp
clang: error: unsupported option '-fopenmp'
error: command 'gcc' failed with exit status 1
Any thoughts as to why this fails?
Thanks
It looks like you are using an old C compiler that doesn't support OpenMP. We recommend installing a more recent version from the Anaconda repository. For OS X users, the correct package is clang_osx-64. See https://www.anaconda.com/utilizing-the-new-compilers-in-anaconda-distribution-5.
Hi Luigi, as @pulkkins said, it seems that the macOS the default compiler (clang LLVM) does not support openmp yet.
One possible solution is to use Anaconda to create the Pysteps environment and install the following packages:
conda install llvm gcc libgcc
And then install Pysteps in that environment.
Another option is to update the compilers:
xcode-select --install
export CC=clang ; export CXX=clang
pip install git+https://github.com/pySTEPS/pysteps
Hope this helps.
Thanks! I'll give it a try and confirm success one way or another. Regards!
Reference to this Another option is to update compilers
For me the above command didn't work but this one worked.
export CC=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8
Hi @m-anand, thanks for the other solution. Did you update the compilers using homebrew? Can you share the commands that you used so they can be used as reference?
Thanks!
Hi @m-anand, thanks for the other solution. Did you update the compilers using homebrew? Can you share the commands that you used so they can be used as reference?
Thanks!
I used :
brew install gcc
export CC=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8
and it worked.
I've update gcc using brew as suggested by @m-anand but it didnt work. I get slightly further than last time, but invariably:
creating build/temp.macosx-10.9-x86_64-3.7/pysteps/motion
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c pysteps/motion/_vet.c -o build/temp.macosx-10.9-x86_64-3.7/pysteps/motion/_vet.o -fopenmp
clang: error: unsupported option '-fopenmp'
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;file='/private/var/folders/n_/1n0301tj0xv1nzcgmsn03qk40000gn/T/pip-req-build-mhfad__q/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/n_/1n0301tj0xv1nzcgmsn03qk40000gn/T/pip-record-j83nr5ce/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/n_/1n0301tj0xv1nzcgmsn03qk40000gn/T/pip-req-build-mhfad__q/
I think I will end trying to get this installed on my mac. It is successfully running under linux. Thanks all for your help.
Luigi, I will try borrow a Mac computer and try to reproduce your error.
I will keep the issue open until I add a the installation instructions for OSX to the documentation.
An alternative solution for anaconda users on OSX
On your anaconda environment (source activate my_environment_name
) install the anaconda gcc compilers:
conda install gcc
Check that the conda gcc version is going to be used:
which gcc
The output should look something like this:
/path/to/the/anaconda/distribution/envs/my_environment_name/bin/gcc
Then, unset the CC variable to make sure that it is not using the system's gcc:
unset CC
Finally, install pysteps as usual. Now, the installer should use the conda gcc compiler that supports openmp.
Thanks @bernatp3rs trying this out!
Thanks. Unfortunately resulted in a new error message.
This is the sequence of steps I followed:
conda env create -f environment.yml
conda activate pysteps
Checked that the gcc had correct path:
which gcc
it returned:
/anaconda3/envs/pysteps/bin/gcc
The I tried:
pip install git+https://github.com/pySTEPS/pysteps
but ended up with the following:
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c pysteps/motion/_vet.c -o build/temp.macosx-10.9-x86_64-3.7/pysteps/motion/_vet.o -fopenmp
In file included from /anaconda3/envs/pysteps/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/syslimits.h:7:0,
from /anaconda3/envs/pysteps/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:34,
from /Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:11,
from pysteps/motion/_vet.c:30:
/anaconda3/envs/pysteps/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
#include_next <limits.h> /* recurse down to the real one */
^
compilation terminated.
error: command 'gcc' failed with exit status 1