pypsa-eur/doc/installation.rst

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

111 lines
4.3 KiB
ReStructuredText
Raw Permalink Normal View History

..
2024-02-19 15:21:48 +00:00
SPDX-FileCopyrightText: 2019-2024 The PyPSA-Eur Authors
SPDX-License-Identifier: CC-BY-4.0
2019-08-07 08:56:23 +00:00
.. _installation:
2019-06-07 08:34:36 +00:00
##########################################
Installation
##########################################
2019-08-10 20:46:26 +00:00
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.
2019-08-06 14:53:32 +00:00
Clone the Repository
====================
First of all, clone the `PyPSA-Eur repository <https://github.com/PyPSA/pypsa-eur>`__ using the version control system ``git`` in the command line.
2019-08-06 14:53:32 +00:00
.. code:: bash
/some/other/path % cd /some/path
2019-08-06 14:53:32 +00:00
/some/path % git clone https://github.com/PyPSA/pypsa-eur.git
2019-08-06 14:53:32 +00:00
2019-08-07 08:56:23 +00:00
.. _deps:
2019-08-06 14:53:32 +00:00
Install Python Dependencies
===============================
2019-08-10 20:46:26 +00:00
PyPSA-Eur relies on a set of other Python packages to function.
We recommend using the package manager `mamba <https://mamba.readthedocs.io/en/latest/>`__ to install them and manage your environments.
For instructions for your operating system follow the ``mamba`` `installation guide <https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html>`__.
You can also use ``conda`` equivalently.
2019-08-06 14:53:32 +00:00
The package requirements are curated in the `envs/environment.yaml <https://github.com/PyPSA/pypsa-eur/blob/master/envs/environment.yaml>`__ file.
2019-08-06 14:53:32 +00:00
The environment can be installed and activated using
.. code:: bash
2023-04-28 13:23:44 +00:00
.../pypsa-eur % mamba env create -f envs/environment.yaml
2019-08-06 14:53:32 +00:00
.../pypsa-eur % mamba activate pypsa-eur
2019-08-08 15:13:36 +00:00
.. note::
The equivalent commands for ``conda`` would be
.. code:: bash
.../pypsa-eur % conda env create -f envs/environment.yaml
.../pypsa-eur % conda activate pypsa-eur
2019-08-08 15:13:36 +00:00
Install a Solver
================
PyPSA passes the PyPSA-Eur network model to an external solver for performing the optimisation.
2019-08-10 20:46:26 +00:00
PyPSA is known to work with the free software
- `HiGHS <https://highs.dev/>`__
- `Cbc <https://projects.coin-or.org/Cbc#DownloadandInstall>`__
- `GLPK <https://www.gnu.org/software/glpk/>`__ (`WinGLKP <http://winglpk.sourceforge.net/>`__)
- `SCIP <https://scipopt.github.io/PySCIPOpt/docs/html/index.html>`__
2019-08-10 20:46:26 +00:00
and the non-free, commercial software (for some of which free academic licenses are available)
2019-08-10 20:46:26 +00:00
- `Gurobi <https://www.gurobi.com/documentation/quickstart.html>`__
- `CPLEX <https://www.ibm.com/products/ilog-cplex-optimization-studio>`__
- `FICO Xpress Solver <https://www.fico.com/de/products/fico-xpress-solver>`__
2019-08-08 15:13:36 +00:00
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.
2019-08-10 20:46:26 +00:00
.. 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>`__
2019-08-10 20:46:26 +00:00
.. note::
2024-02-19 16:15:20 +00:00
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
.. code:: bash
mamba activate pypsa-eur
mamba install -c gurobi gurobi
Additionally, you need to setup your `Gurobi license <https://www.gurobi.com/solutions/licensing/>`__.
.. _defaultconfig:
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`.
You can also use ``snakemake`` to specify another file, e.g.
``config/config.mymodifications.yaml``, to update the settings of the ``config/config.yaml``.
.. code:: bash
.../pypsa-eur % snakemake -call --configfile config/config.mymodifications.yaml