简体   繁体   中英

error: command 'gcc' failed with exit status 1 installing Fatiando (Python Package)

I am trying to install fatiando, a geophysical modelling package for Python. I have a Mac with OS X v10.9.5. I am getting all the dependencies for Fatiando (via Anaconda) by following the recommended installation suggested on the package site . I have Xcode installed.

I get a list of warnings and a final error message:

    fatiando/gravmag/_polyprism.c:349:10: fatal error: 'omp.h' file not found

    #include "omp.h"

             ^

    1 warning and 1 error generated.

    error: command 'gcc' failed with exit status 1

    ----------------------------------------
    Command "//anaconda/bin/python -c "import setuptools, tokenize;__file__='/var/folders/32/mwq0jhwd3dx7vjqmm8hkljp80000gn/T/pip-QFjo6d-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/32/mwq0jhwd3dx7vjqmm8hkljp80000gn/T/pip-CY4vyX-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /var/folders/32/mwq0jhwd3dx7vjqmm8hkljp80000gn/T/pip-QFjo6d-build
Macintosh-5:fatiando matteoniccoli$ 

The full Terminal output (1100+ lines) can be found here .

I already contacted the developers, this does not seem to be a Fatiando issue.

Any suggestions?

UPDATE, March 15

When I first posted this I did not have Xcode, then I downloaded the latest Xcode from Apple store. Tried again, got the same message. Then I read this and downloaded gcc from here , and installed directly. When I type on terminal: gcc --version , I get this: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00) After that, though, I still get similar messages. Following another stackoverflow lead, I tried to install setuptools from here using curl https://bootstrap.pypa.io/ez_setup.py -o - | python Now I get a different error (at the end again of a long output) when I try to install fatiando:

fatiando/gravmag/_polyprism.c:349:10: fatal error: 'omp.h' file not found

    #include "omp.h"

             ^  

    1 warning and 1 error generated.  

    error: command '/usr/bin/clang' failed with exit status 1

    ----------------------------------------

    Command "//anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/32/mwq0jhwd3dx7vjqmm8hkljp80000gn/T/pip-build-m1ieVO/fatiando/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/32/mwq0jhwd3dx7vjqmm8hkljp80000gn/T/pip-9wI6Z7-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/32/mwq0jhwd3dx7vjqmm8hkljp80000gn/T/pip-build-m1ieVO/fatiando

Someone from a forum asked me by email: Re Fatiando, did you install Xcode command line tools? Eg see this http://railsapps.github.io/xcode-command-line-tools.html

But when I try to verify tI've successfully installed Xcode Command Line Tools as suggested there, I get this, so I assume it was not the issue:

-bash: /Library/Developer/CommandLineTools: is a directory

UPDATE MARCH 16 Tried solution suggested by Leo Uieda.

pip install --upgrade https://github.com/fatiando/fatiando/archive/kill-omp.zip went without a problem, but

pip install --upgrade https://github.com/fatiando/fatiando/archive/master.zip gets me back at square 1:

...
...    
fatiando/gravmag/_polyprism.c:349:10: fatal error: 'omp.h' file not found

        #include "omp.h"

                 ^

        1 warning and 1 error generated.

        error: command '/usr/bin/clang' failed with exit status 1

        ----------------------------------------
        Rolling back uninstall of fatiando

This is a very common problem with the Fatiando install, specially on Windows and Mac. OpenMP was introduced in PR 106 for the fatiando.gravmag forward modeling modules. It was easy to implement (just replace a range(ndata) with a prange(ndata) ) and was resulting in 1.5-2x speedup over sequential execution. Also, the parallel execution was automatic. So it seemed like a good trade-off at the time ("Just install an extra dependency? What could go wrong?").

The problems began when the Anaconda gcc and the default Mac gcc didn't come with OpenMP. So Windows users had to install an extra dependency (in a very specific order, like a satanic ritual) and Mac users had to fend for themselves.

OpenMP and compiled Cython modules are being removed from Fatiando ( #169 ) in preference of multiprocessing and numba . This would make it a pure Python package (no compilation necessary) and most of the install issues should be resolved.

In the mean time, PR 177 removes the OpenMP requirement from the Cython modules. This should fix your current install problems. To get the changes right away, you can install the version from the kill-omp branch by running:

pip install --upgrade https://github.com/fatiando/fatiando/archive/kill-omp.zip

If the above command doesn't work, it means that the pull request has been merged into the main branch of the project (master). If that's the case, you can install the latest version from the master branch:

pip install --upgrade https://github.com/fatiando/fatiando/archive/master.zip

These changes will be included in the future v0.4 release. Hope this fixes your problem.

(It would be useful to know which version of gcc you are using.)

gcc did not ship with OpenMP prior to v4.9.

See this answer could help you update gcc it using xcode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM