2020-05-29 07:50:55 +00:00
..
2023-02-16 10:50:55 +00:00
SPDX-FileCopyrightText: 2019-2023 The PyPSA-Eur Authors
2020-12-03 18:50:53 +00:00
2020-05-29 07:50:55 +00:00
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
====================
2023-03-15 16:00:06 +00:00
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
2023-03-15 16:00:06 +00:00
/some/other/path % cd /some/path
2019-08-06 14:53:32 +00:00
2023-03-15 16:00:06 +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.
2023-03-15 16:00:06 +00:00
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.html> `_ .
You can also use `` conda `` equivalently.
2019-08-06 14:53:32 +00:00
2023-03-15 16:00:06 +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-03-15 16:00:06 +00:00
.../pypsa-eur % mamba create -f envs/environment.yaml
2019-08-06 14:53:32 +00:00
2023-03-15 16:00:06 +00:00
.../pypsa-eur % mamba activate pypsa-eur
2019-08-08 15:13:36 +00:00
2020-05-28 18:36:45 +00:00
.. note ::
2023-03-15 16:00:06 +00:00
The equivalent commands for `` conda `` would be
2020-05-28 18:36:45 +00:00
.. code :: bash
2020-12-03 18:50:53 +00:00
2023-03-15 16:00:06 +00:00
.../pypsa-eur % conda env create -f envs/environment.yaml
2020-05-28 18:36:45 +00:00
2023-03-15 16:00:06 +00:00
.../pypsa-eur % conda activate pypsa-eur
2020-05-28 18:36:45 +00:00
2019-08-08 15:13:36 +00:00
Install a Solver
================
2023-03-15 16:00:06 +00:00
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
2023-03-15 16:00:06 +00:00
- `HiGHS <https://highs.dev/> `_
2019-08-10 20:46:26 +00:00
- `Cbc <https://projects.coin-or.org/Cbc#DownloadandInstall> `_
- `GLPK <https://www.gnu.org/software/glpk/> `_ (`WinGLKP <http://winglpk.sourceforge.net/> `_ )
2023-03-15 16:00:06 +00:00
- `Ipopt <https://coin-or.github.io/Ipopt/INSTALL.html> `_
2019-08-10 20:46:26 +00:00
2020-12-05 16:54:50 +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
2020-05-28 18:36:45 +00:00
- `Gurobi <https://www.gurobi.com/documentation/quickstart.html> `_
2019-08-10 20:46:26 +00:00
- `CPLEX <https://www.ibm.com/products/ilog-cplex-optimization-studio> `_
2023-03-15 16:00:06 +00:00
- `FICO Xpress Solver <https://www.fico.com/de/products/fico-xpress-solver> `_
2019-08-08 15:13:36 +00:00
2020-01-24 16:02:09 +00:00
For installation instructions of these solvers for your operating system, follow the links above.
2023-03-15 16:00:06 +00:00
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 ::
2023-03-15 16:00:06 +00:00
`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
2020-01-24 16:02:09 +00:00
.. note ::
The rules :mod: `cluster_network` and :mod: `simplify_network` solve a quadratic optimisation problem for clustering.
The open-source solvers Cbc and GlPK cannot handle this. A fallback to Ipopt is implemented in this case, but requires
2023-03-15 16:00:06 +00:00
it to be installed. For an open-source solver setup install in your `` conda `` environment on OSX/Linux
2020-01-24 16:02:09 +00:00
.. code :: bash
2023-03-15 16:00:06 +00:00
mamba activate pypsa-eur
mamba install -c conda-forge ipopt coincbc
2020-01-24 16:02:09 +00:00
and on Windows
.. code :: bash
2020-12-03 18:50:53 +00:00
2023-03-15 16:00:06 +00:00
mamba activate pypsa-eur
mamba install -c conda-forge ipopt glpk
2020-12-03 18:50:53 +00:00
2023-03-15 16:00:06 +00:00
For HiGHS, run
2023-02-16 10:50:55 +00:00
.. code :: bash
2023-03-15 16:00:06 +00:00
mamba activate pypsa-eur
mamba install -c conda-forge ipopt
2023-02-16 10:50:55 +00:00
pip install highspy
2020-01-24 16:02:09 +00:00
2023-03-15 16:00:06 +00:00
For 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/> `_ .
2019-10-03 10:37:23 +00:00
.. _defaultconfig:
2023-03-15 16:00:06 +00:00
Handling Configuration Files
============================
2019-10-03 10:37:23 +00:00
2023-03-15 16:00:06 +00:00
PyPSA-Eur has several configuration options that must be specified in a
`` config.yaml `` file located in the root directory. An example configuration
`` config.default.yaml `` is maintained in the repository, which will be used to
automatically create your customisable `` config.yaml `` on first use. More
details on the configuration options are in :ref: `config` .
2019-10-03 10:37:23 +00:00
2023-03-15 16:00:06 +00:00
You can also use `` snakemake `` to specify another file, e.g.
`` config.mymodifications.yaml `` , to update the settings of the `` config.yaml `` .
2019-10-03 10:37:23 +00:00
.. code :: bash
2023-03-15 16:00:06 +00:00
.../pypsa-eur % snakemake -call --configfile config.mymodifications.yaml
2019-10-03 10:37:23 +00:00
2023-03-15 16:00:06 +00:00
.. warning ::
Users are advised to regularly check their own `` config.yaml `` against changes
in the `` config.default.yaml `` when pulling a new version from the remote
repository.