.. _installation:
Installation
====================
**Requirements**
It is recommended to install DEM in a dedicated ``Conda`` environment to ensure that all dependencies are available in compatible versions (see the steps below).
To run optimisation studies, a solver must be installed before installing DEM. If only simulations are required, no solver installation is necessary. Optimisation in DEM is implemented using the |Calliope_link| framework, and any solver listed on the |Calliope_documentation_link| can be used.
.. note::
DEM has been tested on Windows with |Calliope_version_link| in combination with the |Gurobi_link| solver.
**Step 1: Create the Conda Environment**
If not already done, download and install |Conda_link| on your operating system. Next, create the dedicated ``Conda`` environment. DEM is tested with the ``Conda`` environment provided in a file on GitHub. Locate the file named ``dem_conda_environment_vX_Y_Z.yml`` (or similar) in the |GitHub_config_link|. Click on the file (see screenshot 1) and download it (see arrow on screenshot 2). Make sure to use the correct version (e.g. ``dem_conda_environment_v0_1_0.yml`` for version ``0.1.0``). In the file you can also see the name of the environment that will be created (see red rectangle in screenshot 2).
*Screenshot 1:*
.. image:: images/github_conda_file.png
:width: 90%
*Screenshot 2:*
.. image:: images/github_download_file.png
:width: 90%
Open the Anaconda Prompt window and navigate to the directory where the .yml file is located. The ``dir`` command will show you the content of the current directory. The ``cd`` command lets you navigate to these directories (e.g., ``cd path/to/folder``).
Create a new ``Conda`` environment from the .yml file (exact name depends on version):
.. code-block:: shell
conda env create -f dem_conda_environment_v0_1_0_rc0.yml
This process might take a while, depending on the performance of the computer.
Activate the environment (exact name depends on installed version):
.. code-block:: shell
conda activate dem_0_1_0_rc0
Refer to the |Conda_doc_link| for instructions. If you are unfamiliar with Conda, consult the |Conda_userguide_link|.
**Step 2: Install the District Energy Model**
After activating the environment, install DEM with ``pip``:
.. code-block:: shell
pip install district_energy_model
Now you can run the model (see :doc:`run_model`).
.. Links:
.. |Calliope_link| raw:: html
Calliope
.. |Calliope_documentation_link| raw:: html
Calliope documentation page
.. |Calliope_version_link| raw:: html
Calliope v0.6.8
.. |Gurobi_link| raw:: html
Gurobi
.. |Conda_link| raw:: html
Conda
.. |GitHub_link| raw:: html
GitHub
.. |GitHub_config_link| raw:: html
config directory
.. |Conda_doc_link| raw:: html
Conda documentation
.. |Conda_userguide_link| raw:: html
user guide