Problem installing natcap.invest Python package

I have been trying to run the InVEST “Annual Water Yield” model from Python (Google Colab) as part of the sensitivity analysis and calibration of the model. The error as attached pops up. The code used was generated from the InVEST software itself.

Unable to run the python code for “Annual Water Yield” from Google Colab

“could not find a version that satisfies the requirement natcap” message pops up

Hi @sachin , thanks for posting. The name of the package you’ll need to install is actually natcap.invest, rather than just natcap.

And we recommend installing it from conda-forge, rather than using pip, because of challenges with compiling GDAL binaries. All the details are here: Installing the InVEST Python Package — InVEST 3.14.1.post148+g59145ca.d20240403 documentation

Please let us know if that works for you!

I would like to know what version of python needs to be configured to be compatible if the files provided by the API can be used normally. If I use 3.9 and 3.11, it is not fully compatible

Thank you for the reply. I will try the edits and keep you posted

I have tried “conda-forge” and the following error occurs. I checked my system for Python 3.12 and the version 3.12.2 is already installed.

natcap.invest is not currently available for Python 3.12. The final green message in your console indicates that the latest version of `natcap.invest (3.14.1) requires Python less than 3.12. In other words, Python 3.11.x will work.

I recommend creating a new virtual environment with conda and specify python=3.11. Then install natcap.invest.

For example,

conda create -n env-invest "python=3.11"
conda activate env-invest
conda install natcap.invest -c conda-forge

Thank you for the update

Thank you for the support.
The InVEST code (natcap.invest) works fine in Anaconda Prompt python 3.11

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.