From source#


if you install gym-DSSAT from source, you must use pdirun when launching your scripts. For instance: pdirun python3 Ensure that pdirun path is correctly exported.


  • CMake >= 3.10

  • C, C++ and Fortran compilers, for instance GNU’s gcc, g++ and gfortran

  • Python >= 3.8

  • The following Python packages:

    • matplotlib==3.3.4

    • numpy==1.24.1

    • Jinja2

    • pyzmq

    • gym==0.21.0, higher gym versions are known to cause problems


Please follow the installation procedure in the same order as below.

1. PDI Data Interface (PDI)#

In order to install the PDI software, you can check the official instructions but be careful to correctly set cmake flags as shown below.

Recommended installation directories are /opt/pdi or ${HOME}/.pdi ; if possible avoid /usr/local/. In the following we assume PDI to be installed in /opt/pdi. You can find more details, including PID’s dependencies here.

git clone
mkdir pdi/build && cd pdi/build
cmake -DCMAKE_INSTALL_PREFIX='/opt/pdi' \
    -DUSE_DEFAULT=EMBEDDED .. # configuration
sudo make install   # compilation and installation


First, clone this repository and its submodules.

git clone --recurse-submodules

From the root of this repository, supposing PDI has been installed in /opt/pdi and (modified) DSSAT to be installed in /opt/dssat_pdi:

cd dssat-csm-os
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX='/opt/dssat_pdi' -DCMAKE_PREFIX_PATH='/opt/pdi/share/paraconf/cmake;/opt/pdi/share/pdi/cmake' ..
sudo make install

Note: if for some reason DSSAT compilation failed, please empty the folder dssat-csm-os/build before retrying to compile DSSAT

After then, you will need to provide DSSAT the required experimental files. From the root of this repository, assuming DSSAT has been installed in /opt/dssat_pdi :

cd dssat-csm-data
sudo cp -r ./* /opt/dssat_pdi

Finally, export DSSAT-PDI path with:

export PATH=/opt/dssat_pdi:$PATH


If DSSAT-PDI path is not exported, gym-DSSAT won’t be able to find the run_dssat executable.

3. gym-DSSAT#

From the root of this repository:

cd gym-dssat-pdi
pip install -e .