Installing natcap.invest within Anaconda environment on MacOSX fails: known issue?

chrnoltechrnolte Member
edited February 28 in General
I am attempting to install natcap.invest within an Anaconda environment on OSX 10.14.3 (Mojave)

Following the documentation, I installed most dependencies via Conda, and executed the pip install command with the option --no-binary :all: (--egg is not accepted as an option; it throws a "no such option" error.).

However, the installation fails when running install for pygeoprocessing, throwing the following error:

    src/pygeoprocessing/routing/routing.cpp:633:10: fatal error: 'ios' file not found
    #include "ios"
    2 warnings and 1 error generated.
    error: command 'gcc' failed with exit status 1

I attach a text file with the full error output in Terminal. It also includes the conda installation command and output, and thus the complete information on all installed packages

My attempts at troubleshooting via Google indicate that there's an issue with the XCode version (see posts here and here). When I first came across this error, Software Update indicated that XCode was current. I have since updated XCode and its command line tools to the most recent development version, and the issue still occurs.

Any suggestions what steps to take next? I'm thrilled by the prospect of running InVEST directly from Python.
Post edited by chrnolte on


  • jdouglassjdouglass Administrator, NatCap Staff
    Hmm, never seen this error before!  Could you make sure you have the xcode command-line tools installed?  At a bash shell, should be a matter of xcode-select --install.
  • chrnoltechrnolte Member
    Thanks for considering this request. Yes, the command line tools are installed.
  • jdouglassjdouglass Administrator, NatCap Staff
    OK, well that's not the issue, then :)

    It turns out that there are a couple of us around natcap who are also experiencing this issue.  I unfortunately don't have a permanent solution for this (maybe the forthcoming XCode 10.2 release will?), but there is a workaround: don't compile under conda.

    The natcap.invest and pygeoprocessing packages only require numpy and cython for compilation, both of which are readily installable from PyPI via pip.  So here's what I'd suggest doing for both pygeoprocessing and natcap.invest

    * Download the source code from PyPI.
    * Extract the archive
    * In a terminal shell that is *not* activated with your conda environment, cd to the extracted folder and run "python bdist_wheel".  This will put a .whl file in the dist folder in that directory.
    * In a terminal shell that *is* activated with your conda environment, use "pip install <path to .whl file>" to install the built package.

    You'll need to do this for both pygeoprocessing and natcap.invest, probably in that order.

    Doing this, I'm able to import both packages within my anaconda environment on mac.
Sign In or Register to comment.