Installing the InVEST Python Package¶
Most users will want to install the InVEST app (Mac disk image or Windows installer) from the InVEST download page. The instructions here are for more advanced use cases.
The InVEST package is available for installation from three distribution channels:
As a binary wheel or source package from the Python Package Index
As a source installation, directly from our git source tree
Note that installing the python package does not include a user interface.
mamba install -c conda-forge natcap.invest
If you prefer to use
conda, the command is otherwise the same:
conda install -c conda-forge natcap.invest
natcap.invest package is also available from the
Python Package Index
and installable with
pip. Binary builds of
natcap.invest are available for
64-bit x86 architectures and also as a source distribution. Note that if you
have a computer with a non-x86-compatible architecture (such as a Mac with
one of the M-series chips), you will either need to have a compiler installed
or you will want to install
conda-forge (see above).
pip install natcap.invest
pip install natcap.invest will fail with a compilation error if
GDAL is not already installed.
natcap.invest depends on the underlying
GDAL binaries, which cannot be installed via
pip. For details on installing
GDAL on your system, see https://gdal.org/download.html.
Errors Compiling GDAL¶
If you see one of these errors, you need to install GDAL:
FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
It is also possible to have a compatible version of GDAL installed, but for
pip to try to compile the GDAL bindings anyways. This happens when a newer
version of the GDAL python bindings are available on the Python Package Index
than are installed on your system. The error message you see will look
something like this:
bool CPL_DLL GDALDatasetAddFieldDomain(GDALDatasetH hDS, ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 1 warning and 20 errors generated. error: command '/usr/bin/clang' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for GDAL Running setup.py clean for GDAL
To work around this error when you have a compatible version of GDAL already installed,
pip to only upgrade packages if needed:
pip install natcap.invest --upgrade-strategy=only-if-needed
Installing from source¶
To install the
natcap.invest package from source, you must have a C/C++
compiler installed and configured for your system. MacOS and Linux users
should not need to do anything. Windows users should install Microsoft
Visual Studio, or at least the Build Tools for Visual Studio, if they have
not already. See the python wiki page on compilation under Windows for more information.
If you are looking for the latest unreleased changes to InVEST, you can use the
latest changes in the source tree. This approach requires both a C/C++ compiler
git to be available on your system:
pip install "git+https://github.com/natcap/invest.git@main#egg=natcap.invest"
Note that GDAL must be installed on your system before installing in this way. For details on installing GDAL, see https://gdal.org/download.html.
natcap.invest are listed in
included here for your reference. Your package manager should, under most
circumstances, handle the dependency resolution for you.
GDAL>=3.4.2,<3.7.0 Pyro4==4.77 # pip-only pandas>=1.2.1 numpy>=1.11.0,!=1.16.0 Rtree>=0.8.2,!=0.9.1 shapely>=1.7.1,<1.8.2 # https://github.com/shapely/shapely/issues/1385 scipy>=1.9.0 pygeoprocessing==2.4.0 # pip-only taskgraph[niced_processes]>=0.11.0 # pip-only psutil>=5.6.6 chardet>=3.0.4 pint Babel Flask flask_cors