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.

Install PyPSA-Eur and its data

First install PyPSA-Eur and all its dependencies. Clone the repository:

projects % git clone

then download and unpack all the PyPSA-Eur data files by running the following snakemake rule:

projects/pypsa-eur % snakemake -j 1 retrieve_databundle

Clone PyPSA-Eur-Sec repository

Create a parallel directory for PyPSA-Eur-Sec with:

projects % git clone

Environment/package requirements

The requirements are the same as PyPSA-Eur. For in addition you need gurobipy. If you have xarray version >= 0.15.1, you will need the latest master branch of atlite version 0.0.2.

You can create an environment using the environment.yaml file in pypsa-eur/envs:

.../pypsa-eur % conda env create -f envs/environment.yaml

.../pypsa-eur % conda activate pypsa-eur

See details in PyPSA-Eur Installation

Data requirements

Small data files are included directly in the git repository, while larger ones are archived in a data bundle on zenodo (10.5281/zenodo.5824485). The data bundle’s size is around 640 MB.

To download and extract the data bundle on the command line:

projects/pypsa-eur-sec/data % wget ""
projects/pypsa-eur-sec/data % tar -xvzf pypsa-eur-sec-data-bundle.tar.gz

The data licences and sources are given in the following table.

description file/folder licence source    
JRC IDEES database jrc-idees-2015/ CC BY 4.0    
urban/rural fraction urban_percent.csv unknown unknown    
JRC biomass potentials biomass/ unknown    
JRC ENSPRESO biomass potentials remote CC BY 4.0    
EEA emission statistics eea/UNFCCC_v23.csv EEA standard re-use policy    
Eurostat Energy Balances eurostat-energy_balances-*/ Eurostat    
Swiss energy statistics from Swiss Federal Office of Energy switzerland-sfoe/ unknown    
BASt emobility statistics emobility/ unknown    
BDEW heating profile heat_load_profile_BDEW.csv unknown    
heating profiles for Aarhus heat_load_profile_DK_AdamJensen.csv unknown Adam Jensen MA thesis at Aarhus University    
George Lavidas wind/wave costs WindWaveWEC_GLTB.xlsx unknown George Lavidas    
country codes Country_codes.csv CC BY 4.0 Marta Victoria    
co2 budgets co2_budget.csv CC BY 4.0    
existing heating potentials existing_infrastructure/existing_heating_raw.csv unknown    
IRENA existing VRE capacities existing_infrastructure/{solar|onwind|offwind}_capcity_IRENA.csv unknown    
USGS ammonia production myb1-2017-nitro.xls unknown    
hydrogen salt cavern potentials h2_salt_caverns_GWh_per_sqkm.geojson CC BY 4.0    
international port trade volumes attributed_ports.json CC BY 4.0—International-Ports    
hotmaps industrial site database Industrial_Database.csv CC BY 4.0    
Hotmaps building stock data data_building_stock.csv CC BY 4.0    
U-values Poland u_values_poland.csv unknown    
Floor area missing in hotmaps building stock data floor_area_missing.csv unknown    
Comparative level investment comparative_level_investment.csv Eurostat    
Electricity taxes electricity_taxes_eu.csv Eurostat    
Building topologies and corresponding standard values tabula-calculator-calcsetbuilding.csv unknown    
Retrofitting thermal envelope costs for Germany retro_cost_germany.csv unknown    
District heating most countries jrc-idees-2015/ CC BY 4.0    
District heating missing countries district_heat_share.csv unknown    

Set up the default configuration

First make your own copy of the config.yaml based on
config.default.yaml. For example:
projects/pypsa-eur-sec % cp config.default.yaml config.yaml

Getting started

In config.yaml you can control the settings for the scenarios you want to run, such as the number of nodes, the CO2 limit, the installable potentials for solar and wind, which technologies are activated, etc.

To run the full optimization with your settings:

projects/pypsa-eur-sec % snakemake -j1

Warning: you may need a computer cluster for this (with e.g. 10-100 GB of RAM and several processors).

To only prepare the networks, you can run the scripts up to the point before optimization:

projects/pypsa-eur-sec % snakemake -j1 prepare_sector_networks