Natcap.invest python version

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,
The current virtual environment is python3.11,the following bags,but gdal can’t be imported

packages in environment at D:\anaconda3\envs\py3:

Name Version Build Channel

asttokens 2.0.5 pyhd3eb1b0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
babel 2.14.0 pyhd8ed1ab_0 conda-forge
backcall 0.2.0 pyhd3eb1b0_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
blinker 1.7.0 pyhd8ed1ab_0 conda-forge
blosc 1.21.5 hdccc3a2_0 conda-forge
boost-cpp 1.78.0 h9f4b32c_4 conda-forge
bottleneck 1.3.7 py311h59ca53f_1 conda-forge
brotli-python 1.1.0 py311h12c1d0e_1 conda-forge
bzip2 1.0.8 hcfcfb64_5 conda-forge
ca-certificates 2024.2.2 h56e8100_0 conda-forge
cairo 1.16.0 hdecc03f_1016 conda-forge
cartopy 0.22.0 pypi_0 pypi
certifi 2024.2.2 pyhd8ed1ab_0 conda-forge
cfitsio 4.2.0 h9ebe7e4_0 conda-forge
cftime 1.6.0 pypi_0 pypi
chardet 5.2.0 py311h1ea47a8_1 conda-forge
charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge
click 8.1.7 win_pyh7428d3b_0 conda-forge
colorama 0.4.6 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
comm 0.1.2 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
contourpy 1.1.1 pypi_0 pypi
curl 8.7.1 hd5e4a3a_0 conda-forge
cycler 0.12.1 pypi_0 pypi
cython 0.29.37 py311h12c1d0e_0 conda-forge
debugpy 1.6.7 py311hd77b12b_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
decorator 5.1.1 pyhd3eb1b0_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
et_xmlfile 1.1.0 pyhd8ed1ab_0 conda-forge
executing 0.8.3 pyhd3eb1b0_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
expat 2.5.0 h63175ca_1 conda-forge
flask 3.0.2 pyhd8ed1ab_0 conda-forge
flask_cors 3.0.10 pyhd3deb0d_0 conda-forge
font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge
font-ttf-inconsolata 3.000 h77eed37_0 conda-forge
font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge
font-ttf-ubuntu 0.83 h77eed37_1 conda-forge
fontconfig 2.14.2 hbde0cde_0 conda-forge
fonts-conda-ecosystem 1 0 conda-forge
fonts-conda-forge 1 0 conda-forge
fonttools 4.43.1 pypi_0 pypi
freetype 2.12.1 hdaf720e_2 conda-forge
freexl 1.0.6 h67ca5e6_1 conda-forge
fsspec 2023.9.2 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
gdal 3.4.3 pypi_0 pypi
geos 3.11.2 h1537add_0 conda-forge
geotiff 1.7.1 h7222e44_8 conda-forge
gettext 0.21.1 h5728263_0 conda-forge
hdf4 4.2.15 h1334946_6 conda-forge
hdf5 1.14.0 nompi_h918d9b7_103 conda-forge
icc_rt 2022.1.0 h6049295_2 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
icu 72.1 h63175ca_0 conda-forge
idna 3.6 pyhd8ed1ab_0 conda-forge
importlib-metadata 7.1.0 pyha770c72_0 conda-forge
importlib_metadata 7.1.0 hd8ed1ab_0 conda-forge
intel-openmp 2024.0.0 h57928b3_49840 conda-forge
ipykernel 6.25.0 py311h746a85d_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
ipython 8.15.0 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
itsdangerous 2.1.2 pyhd8ed1ab_0 conda-forge
jedi 0.18.1 py311haa95532_1 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
jinja2 3.1.3 pyhd8ed1ab_0 conda-forge
jupyter_client 8.6.0 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
jupyter_core 5.5.0 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
kealib 1.5.1 hc8369a0_3 conda-forge
kiwisolver 1.4.5 pypi_0 pypi
krb5 1.21.2 heb0366b_0 conda-forge
lcms2 2.15 h3e3b177_1 conda-forge
lerc 4.0.0 h63175ca_0 conda-forge
libaec 1.1.3 h63175ca_0 conda-forge
libblas 3.9.0 18_win64_mkl conda-forge
libcblas 3.9.0 18_win64_mkl conda-forge
libcurl 8.7.1 hd5e4a3a_0 conda-forge
libdeflate 1.18 hcfcfb64_0 conda-forge
libexpat 2.5.0 h63175ca_1 conda-forge
libffi 3.4.2 h8ffe710_5 conda-forge
libgdal 3.5.3 h36c8192_28 conda-forge
libglib 2.78.1 he8f3873_0 conda-forge
libhwloc 2.9.3 default_haede6df_1009 conda-forge
libiconv 1.17 hcfcfb64_2 conda-forge
libjpeg-turbo 2.1.5.1 hcfcfb64_1 conda-forge
libkml 1.3.0 hd45a9bc_1016 conda-forge
liblapack 3.9.0 18_win64_mkl conda-forge
libnetcdf 4.9.2 nompi_ha5afab8_105 conda-forge
libpng 1.6.43 h19919ed_0 conda-forge
libpq 15.6 h94c9ec1_0 conda-forge
librttopo 1.1.0 he1da8c1_13 conda-forge
libsodium 1.0.18 h62dcd97_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
libspatialindex 1.9.3 h39d44d4_4 conda-forge
libspatialite 5.0.1 hca1f1ac_26 conda-forge
libsqlite 3.44.2 hcfcfb64_0 conda-forge
libssh2 1.11.0 h7dfc565_0 conda-forge
libtiff 4.5.1 h6c8260b_1 conda-forge
libwebp-base 1.3.2 hcfcfb64_0 conda-forge
libxml2 2.12.6 hc3477c8_1 conda-forge
libzip 1.10.1 h1d365fa_3 conda-forge
libzlib 1.2.13 hcfcfb64_5 conda-forge
lz4-c 1.9.4 hcfcfb64_0 conda-forge
markupsafe 2.1.5 py311ha68e1ae_0 conda-forge
matplotlib 3.8.0 pypi_0 pypi
matplotlib-inline 0.1.6 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
mkl 2022.1.0 h6a75c08_874 conda-forge
natcap.invest 3.14.1 py311h12feb9d_0 conda-forge
nest-asyncio 1.5.6 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
netcdf4 1.6.0 pypi_0 pypi
numexpr 2.8.4 mkl_py311h9a3bfb6_1 conda-forge
numpy 1.26.3 py311h0b4df5a_0 conda-forge
openjpeg 2.5.0 ha2aaf27_2 conda-forge
openpyxl 3.1.2 py311ha68e1ae_1 conda-forge
openssl 3.2.1 hcfcfb64_1 conda-forge
packaging 23.2 pyhd8ed1ab_0 conda-forge
pandas 2.1.4 py311hf63dbb6_0 conda-forge
parso 0.8.3 pyhd3eb1b0_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
pcre2 10.40 h17e33f8_0 conda-forge
pickleshare 0.7.5 pyhd3eb1b0_1003 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
pillow 10.1.0 pypi_0 pypi
pint 0.23 pyhd8ed1ab_0 conda-forge
pip 23.3.2 pypi_0 pypi
pixman 0.43.4 h63175ca_0 conda-forge
platformdirs 3.10.0 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
poppler 23.05.0 h45d20d0_1 conda-forge
poppler-data 0.4.12 hd8ed1ab_0 conda-forge
postgresql 15.6 h94c9ec1_0 conda-forge
proj 9.2.0 heca977f_0 conda-forge
prompt-toolkit 3.0.43 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
psutil 5.9.0 py311h2bbff1b_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
pthreads-win32 2.9.1 hfa6e2cd_3 conda-forge
pure_eval 0.2.2 pyhd3eb1b0_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
pygeoprocessing 2.4.3 py311h12feb9d_0 conda-forge
pygments 2.15.1 py311haa95532_1 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
pyparsing 3.1.1 pypi_0 pypi
pyproj 3.6.1 pypi_0 pypi
pyro4 4.77 py_0 conda-forge
pyshp 2.3.1 pypi_0 pypi
pysocks 1.7.1 pyh0701188_6 conda-forge
python 3.11.7 h2628c8c_1_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python-tzdata 2023.4 pyhd8ed1ab_0 conda-forge
python_abi 3.11 4_cp311 conda-forge
pytz 2023.3.post1 pyhd8ed1ab_0 conda-forge
pywin32 305 py311h2bbff1b_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
pyzmq 25.1.0 py311hd77b12b_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
requests 2.31.0 pyhd8ed1ab_0 conda-forge
retrying 1.3.3 py_2 conda-forge
rtree 1.2.0 py311hcacb13a_0 conda-forge
scipy 1.12.0 py311h0b4df5a_2 conda-forge
serpent 1.41 pyhd8ed1ab_0 conda-forge
setuptools 69.0.3 pyhd8ed1ab_0 conda-forge
shapely 2.0.2 pypi_0 pypi
six 1.16.0 pyh6c4a22f_0 conda-forge
snappy 1.1.10 hfb803bf_0 conda-forge
sqlite 3.44.2 hcfcfb64_0 conda-forge
stack_data 0.2.0 pyhd3eb1b0_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
taskgraph 0.11.1 pyhd8ed1ab_0 conda-forge
tbb 2021.11.0 h91493d7_0 conda-forge
tiledb 2.13.2 h3132609_0 conda-forge
tk 8.6.13 h5226925_1 conda-forge
tornado 6.3.3 py311h2bbff1b_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
traitlets 5.7.1 py311haa95532_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
typing_extensions 4.10.0 pyha770c72_0 conda-forge
tzdata 2023d h0c530f3_0 conda-forge
ucrt 10.0.22621.0 h57928b3_0 conda-forge
uriparser 0.9.7 h1537add_1 conda-forge
urllib3 2.2.1 pyhd8ed1ab_0 conda-forge
vc 14.3 hcf57466_18 conda-forge
vc14_runtime 14.38.33130 h82b7239_18 conda-forge
vs2015_runtime 14.38.33130 hcb4865c_18 conda-forge
wcwidth 0.2.5 pyhd3eb1b0_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
werkzeug 3.0.1 pyhd8ed1ab_0 conda-forge
wheel 0.42.0 pyhd8ed1ab_0 conda-forge
win_inet_pton 1.1.0 pyhd8ed1ab_6 conda-forge
xarray 2023.12.0 pyhd8ed1ab_0 conda-forge
xarray-datatree 0.0.13 pypi_0 pypi
xerces-c 3.2.5 h63175ca_0 conda-forge
xlrd 2.0.1 pyhd8ed1ab_3 conda-forge
xz 5.2.6 h8d14728_0 conda-forge
zeromq 4.3.4 hd77b12b_0 Index of /anaconda/pkgs/main/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
zipp 3.17.0 pyhd8ed1ab_0 conda-forge
zlib 1.2.13 hcfcfb64_5 conda-forge
zstd 1.5.5 h12be248_0 conda-forge

Hi @Monika , the latest natcap.invest (3.14.1) should be compatible with Python 3.11.

I was able to create a conda environment that works using the following (you may substitute conda for mamba if you prefer)

mamba create -p ./env-py311 "python=3.11"
mamba activate ./env-py311
mamba install natcap.invest -c conda-forge
Python 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:40:50) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import natcap.invest
>>> from osgeo import gdal
>>> print(natcap.invest.__version__)
3.14.1
>>> print(gdal.__version__)
3.5.3

I guess I would recommend you start with a fresh new environment and see if it will work for you.

Thanks for Mr. dave’s reply, I will try to configure the environment with python3.11 immediately!

---- Replied Message ----

From | Dave Fisher via Natural Capital Project Online Communitynotifications@naturalcapitalproject.discoursemail.com |

  • | - |
    Date | 4/9/2024 01:42 |
    To | wm16012277@outlook.com |
    Subject | [Natural Capital Project Online Community] [NatCap Software Support] Natcap.invest python version |

| dave
April 8 |

  • | - |

Hi @Monika , the latest natcap.invest (3.14.1) should be compatible with Python 3.11.

I was able to create a conda environment that works using the following (you may substitute conda for mamba if you prefer)

mamba create -p ./env-py311 "python=3.11"
mamba activate ./env-py311
mamba install natcap.invest -c conda-forge

Python 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:40:50) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import natcap.invest
>>> from osgeo import gdal
>>> print(natcap.invest.__version__)
3.14.1
>>> print(gdal.__version__)
3.5.3

I guess I would recommend you start with a fresh new environment and see if it will work for you.

Hello, Mr. dave, I also encountered a problem. When I ran the sample in sdr, natcap.invest could run very fast, but when I changed to my research area, the code would run very slowly. It had been running for more than 24h, and I adjusted n_works to 1 according to the instructions. But it still took so long that it is still not up and running, I would appreciate your good advice!

@Monika it is normal that it takes a long time to run on large datasets. Are you getting regular logging messages indicating that it is still working?

yes,it is working for a long time ! Through VScode,I can see the time is 4004m,crying@esoth

Yes, it is normal to take many hours or days to run on large datasets. Have you checked the logging? What is the most recent log message?