PyPSA / PyPSA/pypsa-eur

clusters=all does not work with default config

Open
#2,192 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
615
Forks
459
Avg merge
4d 14h
Merged PRs (30d)
6

Description

Version Checks (indicate both or one)
  • I have confirmed this bug exists on the lastest release of PyPSA-Eur.

  • I have confirmed this bug exists on the current master branch of PyPSA-Eur.

Issue Description

Thank you for providing and maintaining this awesome model!

My goal is to get an unclustered version of the full network to create something like the base map linked in the README but interactive like the transport map from @bobbyxng and with power plants like Open Infrastructure Map.

Production and demand is added after clustering, so the documentation for the scenario config promotes an option to set the clusters to all.

Sadly, the model fails to run with this option and the default config: 2026-06-09T123634.430829.snakemake.log

The following error seems to let the run fail:

INFO:__main__:Using biomass potentials for 2030.
ERROR:root:Uncaught exception
Traceback (most recent call last):
  File "/home/alex/test/pypsa-eur/.snakemake/scripts/tmpjh1ih7wi.build_shipping_demand.py", line 59, in <module>
    nodal_demand = demand.loc[countries].fillna(0.0)
                   ~~~~~~~~~~^^^^^^^^^^^
  File "/home/alex/test/pypsa-eur/.pixi/envs/default/lib/python3.12/site-packages/pandas/core/indexing.py", line 1192, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/test/pypsa-eur/.pixi/envs/default/lib/python3.12/site-packages/pandas/core/indexing.py", line 1421, in _getitem_axis
    return self._getitem_iterable(key, axis=axis)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/test/pypsa-eur/.pixi/envs/default/lib/python3.12/site-packages/pandas/core/indexing.py", line 1361, in _getitem_iterable
    keyarr, indexer = self._get_listlike_indexer(key, axis)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/test/pypsa-eur/.pixi/envs/default/lib/python3.12/site-packages/pandas/core/indexing.py", line 1559, in _get_listlike_indexer
    keyarr, indexer = ax._get_indexer_strict(key, axis_name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/test/pypsa-eur/.pixi/envs/default/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 6212, in _get_indexer_strict
    self._raise_if_missing(keyarr, indexer, axis_name)
  File "/home/alex/test/pypsa-eur/.pixi/envs/default/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 6261, in _raise_if_missing
    raise KeyError(f"None of [{key}] are in the [{axis_name}]")
KeyError: "None of [Index(['re', 're', 're', 're', 're', 're', 're', 're', 're', 're',\n       ...\n       'wa', 'wa', 'wa', 'wa', 'wa', 'wa', 'wa', 'wa', 'wa', 'wa'],\n      dtype='object', name='name', length=194)] are in the [index]"

Am I missing configuring something or is this indeed a bug?

Reproducible Example
git clone https://github.com/PyPSA/pypsa-eur
cd pypsa-eur
pixi shell
echo 'scenario:   
  clusters:
  - all
' > config/config.yaml
snakemake -call --until prepare_sector_network
Expected Behavior

Get the full PyPSA-Eur base sector network in resources/networks/base_s_all.nc (generators, storage, demand, lines, links etc.) without any or minimal clustering.

Installed Versions

pixi.lock

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with config/config.yaml using the provided pixi and snakemake commands, then inspect the prepare_sector_network workflow and the build_shipping_demand.py entry point shown in the traceback. Trace how clusters: all produces the country index used for demand lookup; done means the workflow completes and creates resources/networks/base_s_all.nc with the expected network components.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.