Installing via pip¶
To install the PySD package from the Python package index use the pip command:
pip install pysd
Installing with conda¶
To install PySD with conda, using the conda-forge channel, use the following command:
conda install -c conda-forge pysd
Installing from source¶
To install from source, clone the project with git:
git clone https://github.com/SDXorg/pysd.git
or download the latest version from the project repository: https://github.com/SDXorg/pysd
In the source directory use the command:
python setup.py install
PySD requires Python 3.9 or above.
PySD builds on the core Python data analytics stack, and the following third party libraries:
Numpy < 1.24
Pandas (with Excel support: pip install pandas[excel])
xarray >= 2023.09
openpyxl >= 3.1
These modules should build automatically if you are installing via pip. If you are building from source, or if pip fails to load them, they can be loaded with the same pip syntax as above.
In order to plot model outputs as shown in Getting started:
To export data to netCDF (.nc) files:
To export netCDF data to comma or tab separated files with parallel processing:
These Python libraries bring additional data analytics capabilities to the analysis of SD models:
PyMC: a library for performing Markov chain Monte Carlo analysis
Scikit-learn: a library for performing machine learning in Python
NetworkX: a library for constructing networks
GeoPandas: a library for manipulating geographic data
Additionally, the System Dynamics Translator utility developed by Robert Ward is useful for translating models from other system dynamics formats into the XMILE standard, to be read by PySD.
These modules can be installed using pip with a syntax similar to the above.
The PySD Cookbook contains recipes that can help you get set up with PySD.