Error running seasonal water yield in virtual environment

What is the issue or question you have?

I am trying to re-run a seasonal water yield model that I have previously run successfully in the GUI. I want to run it in a conda environment so that I can eventually integrate it into a workflow in R. However, I am getting an error when running the same script in the conda environment that I don’t get in the GUI:

09/05/2023 16:16:03  (natcap.invest.seasonal_water_yield.seasonal_water_yield) seasonal_water_yield._execute(561) INFO prepare and test inputs for common errors
Traceback (most recent call last):
  File "/Users/kevinli/Documents/InVEST_PdS/SeasonalWaterYield/", line 55, in <module>
  File "/Users/kevinli/anaconda3/envs/invest-3130/lib/python3.9/site-packages/natcap/invest/seasonal_water_yield/", line 546, in execute
  File "/Users/kevinli/anaconda3/envs/invest-3130/lib/python3.9/site-packages/natcap/invest/seasonal_water_yield/", line 567, in _execute
  File "/Users/kevinli/anaconda3/envs/invest-3130/lib/python3.9/site-packages/natcap/invest/", line 646, in build_lookup_from_csv
    table = table.applymap(
  File "/Users/kevinli/anaconda3/envs/invest-3130/lib/python3.9/site-packages/pandas/core/", line 10172, in applymap
FutureWarning: DataFrame.applymap has been deprecated. Use instead.

What do you expect to happen?

I expect the model to run normally, as it did when run through the GUI. It also ran successfully in a different conda environment, but I think I lost that one when I had to reinstall conda to the proper version for ARM64.

What have you tried so far?

I have tried running the tool using the same Python script created by the GUI within my conda environment, but I get the error above. The tool seems to run fine in the GUI.

Attach the logfile here:

This is the log file for the successful model run in the GUI.
InVEST-natcap.invest.seasonal_water_yield.seasonal_water_yield-log-2023-09-05–16_12_00.txt (32.4 KB)

1 Like

As noted in the pandas documentation, applymap was deprecated in pandas 2.1.0.

pandas 2.1.0 was released last week, and we haven’t yet updated natcap.invest to support it. You will need to install pandas<2.1.0.

1 Like

Thanks, reverting back to pandas 2.0.3 fixed this.

I had to run:

pip uninstall pandas
pip3 uninstall pandas
conda install pandas=2.0.3

to fully remove pandas 2.1.0 and replace it with pandas 2.0.3

1 Like

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