for more information, see https://pre-commit.ci
4.3 KiB
Installation
The subsequently described installation steps are demonstrated as shell commands, where the path before the % sign denotes the directory in which the commands following the % should be entered.
Clone the Repository
First of all, clone the PyPSA-Eur repository using the version control system git in the command line.
System Message: WARNING/2 (<stdin>, line 20)
Cannot analyze code. Pygments package not found.
.. code:: bash /some/other/path % cd /some/path /some/path % git clone https://github.com/PyPSA/pypsa-eur.git
Install Python Dependencies
PyPSA-Eur relies on a set of other Python packages to function. We recommend using the package manager mamba to install them and manage your environments. For instructions for your operating system follow the mamba installation guide. You can also use conda equivalently.
The package requirements are curated in the envs/environment.yaml file. The environment can be installed and activated using
System Message: WARNING/2 (<stdin>, line 40)
Cannot analyze code. Pygments package not found.
.. code:: bash .../pypsa-eur % mamba env create -f envs/environment.yaml .../pypsa-eur % mamba activate pypsa-eur
Note
The equivalent commands for conda would be
System Message: WARNING/2 (<stdin>, line 49)
Cannot analyze code. Pygments package not found.
.. code:: bash .../pypsa-eur % conda env create -f envs/environment.yaml .../pypsa-eur % conda activate pypsa-eur
Install a Solver
PyPSA passes the PyPSA-Eur network model to an external solver for performing the optimisation. PyPSA is known to work with the free software
and the non-free, 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. Commercial solvers such as Gurobi and CPLEX currently significantly outperform open-source solvers for large-scale problems, and it might be the case that you can only retrieve solutions by using a commercial solver. Nevertheless, you can still use open-source solvers for smaller problems.
System Message: ERROR/3 (<stdin>, line 78)
Unknown directive type "seealso".
.. seealso:: `Instructions how to install a solver in the documentation of PyPSA <https://pypsa.readthedocs.io/en/latest/installation.html#getting-a-solver-for-linear-optimisation>`__
Note
The rules :mod:`cluster_network` and :mod:`simplify_network` solve a mixed-integer quadratic optimisation problem for clustering. The open-source solvers HiGHS, Cbc and GlPK cannot handle this. A fallback to SCIP is implemented in this case, which is included in the standard environment specifications. For an open-source solver setup install for example HiGHS and SCIP in your conda environment on OSX/Linux. To install the default solver Gurobi, run
System Message: ERROR/3 (<stdin>, line 82); backlink
Unknown interpreted text role "mod".System Message: ERROR/3 (<stdin>, line 82); backlink
Unknown interpreted text role "mod".System Message: WARNING/2 (<stdin>, line 87)
Cannot analyze code. Pygments package not found.
.. code:: bash mamba activate pypsa-eur mamba install -c gurobi gurobi
Additionally, you need to setup your Gurobi license.
Handling Configuration Files
PyPSA-Eur has several configuration options that users can specify in a config/config.yaml file. The default configuration config/config.default.yaml is maintained in the repository. More details on the configuration options are in :ref:`config`.
System Message: ERROR/3 (<stdin>, line 100); backlink
Unknown interpreted text role "ref".You can also use snakemake to specify another file, e.g. config/config.mymodifications.yaml, to update the settings of the config/config.yaml.
System Message: WARNING/2 (<stdin>, line 108)
Cannot analyze code. Pygments package not found.
.. code:: bash .../pypsa-eur % snakemake -call --configfile config/config.mymodifications.yaml