Installation#
Getting Python#
If it is your first time with Python, we recommend conda, mamba or pip as easy-to-use package managers. They are available for Windows, Mac OS X and GNU/Linux.
It is always helpful to use dedicated conda/mamba environments or virtual environments.
Getting a solver for optimisation#
PyPSA passes optimisation problems for Power System Optimization to an
external solver. PyPSA is known to work via linopy
with the free software
and the non-free software, commercial software (for some of which free academic licenses are available)
For installation instructions of these solvers for your operating system, follow the links above.
Depending on your operating system, you can also install some of the open-source solvers in a conda
or pip
environment.
For HiGHS on all operating systems:
pip install highspy
For GLPK on all operating systems:
conda install -c conda-forge glpk
For CBC on all operating systems except for Windows:
conda install -c conda-forge coincbc
Note
Commercial solvers such as Gurobi, CPLEX, and Xpress currently significantly outperform open-source solvers for large-scale problems. It might be the case that you can only retrieve solutions by using a commercial solver.
Installing PyPSA with conda#
If you are using conda
you can install PyPSA with:
conda install -c conda-forge pypsa
In all of the above commands you can replace conda
with mamba
if you use this alternative.
Installing PyPSA with pip#
If you have the Python package installer pip
then just run:
pip install pypsa
If you’re feeling adventurous, you can also install the latest master branch from github with:
pip install git+https://github.com/PyPSA/PyPSA.git
Conservative installation#
If you’re very conservative and don’t like package managers, you can just download the code from the PyPSA github repository and add the directory of PyPSA to your python path with e.g.:
import sys
sys.path.append("path/to/PyPSA")
import pypsa
Upgrading PyPSA#
We recommend always keeping your PyPSA installation up-to-date, since bugs get fixed and new features are added. PyPSA is also only tested with the latest stable versions of all the dependent packages for the respective Python versions.
To upgrade PyPSA with pip, do at the command line:
pip install -U pypsa
To upgrade PyPSA with conda, do at the command line:
conda update pypsa
Don’t forget to read the Release Notes regarding API changes that might require you to update your code.