The script saved from software can not execute in Python

Hello community,

I’m trying to execute the SDR model using Python.

So far, I’m using the Python script saved from the software, where all the parameters are same to the GUI, and I’m using the sample data.

However, when I try to execute the Python script in the Pycharm, I always get the error:

ImportError: DLL load failed while importing sdr_core

Does anyone know how to resolve this?

Thanks, and have a great day!

Hello @Bob and welcome to the forums!

The main reason this error occurs is when there is an issue with the underlying environment and/or installation of the natcap.invest python package. The easiest way to resolve this is generally to recreate your environment. I would strongly recommend making sure that your environment is created using conda or mamba, as described in our API documentation: Installing the InVEST Python Package — InVEST 3.16.2.dev78+g92a1509.d20250811 documentation. This way you can make sure that all appropriate dependencies are installed, and this is significantly easier than trying to work with python’s venv.

Please let us know if you have any questions!

James

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