3

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
Community
  • 1
  • 1
MyCarta
  • 808
  • 2
  • 12
  • 37
  • Please include the terminal output in the question, not on an external page. – Ismail Badawi Mar 15 '15 at 02:12
  • It is extremely long Ismail, more than 1100 lines. Should I include the whole thing? I am not sure what's relevant and what is not. – MyCarta Mar 15 '15 at 02:23
  • 2
    Probably related: http://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x – cel Mar 15 '15 at 10:26

2 Answers2

3

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.

Leo Uieda
  • 203
  • 2
  • 6
  • I'll try this evening – MyCarta Mar 16 '15 at 16:22
  • 1
    Sorry, I didn't mean that you should run both commands. Just use the first one for now. In the future, this will get merged into the master branch and will become part of the package officially. You should uninstall Fatiando first, just to be sure. – Leo Uieda Mar 17 '15 at 09:49
2

(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.

Community
  • 1
  • 1
stevejpurves
  • 923
  • 1
  • 7
  • 12
  • 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) - see my update to the question. – MyCarta Mar 16 '15 at 02:35
  • suggestions in 2nd and 3rd answer there do not work. I followed the 1st anser to this tutorial https://solarianprogrammer.com/2013/06/11/compiling-gcc-mac-os-x/ will be trying it. – MyCarta Mar 16 '15 at 02:56