I saved and executed the exact same python script that was generated through InVEST workbench application (and that worked perfectly on the workbench) on python3 but I could not get it work, I get the following error message:
Traceback (most recent call last):
File “”, line 2, in
File “/home/ceciliab/miniconda3/envs/envInVEST/lib/python3.11/site-packages/natcap/invest/annual_water_yield.py”, line 624, in execute
target_pixel_size = pygeoprocessing.get_raster_info(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/ceciliab/miniconda3/envs/envInVEST/lib/python3.11/site-packages/pygeoprocessing/geoprocessing.py”, line 2089, in get_raster_info
raise ValueError(
ValueError: Could not open C:\Users\barouill\input-data\LULC_2018_Clip.tif as a gdal.OF_RASTER
I already checked the following aspects:
the tif files are projected raster with the unit of projection in m
I created a new environment to run the model and tried to update the gdal packages
Note that I used the latest version of natcap.invest
Thanks for posting and welcome to the forum! Could you share what operating system you’re on and a little about the differences in file paths from what you posted?
For instance it looks like the script can’t find:
C:\Users\barouill\input-data\LULC_2018_Clip.tif
But it seems your python environment is set up in a different system:
That could be the issue. If you’re able to, could you try copying your data into your WSL home folder, updating the paths in your script, and trying to run?
I actually have WSL too, so will try to replicate your issue.
That’s a great point Dave. The paths generated in the script from the InVEST Workbench won’t make sense inside of WSL. So you can likely keep your data where it is, but will need to update your paths in the script to reflect the /mnt/c structure Dave mentioned.