247-cfe icon indicating copy to clipboard operation
247-cfe copied to clipboard

version compatibility problem between PyPSA 0.24.0 and Linopy 0.5.5, where the linopy model expects customized dimension names but PyPSA is providing non-customized ones.

Open MaykThewessen opened this issue 5 months ago • 0 comments

What package versions should I install? -> this is not mentioned in 'environment.yaml' ?

Version compatibility problem between PyPSA 0.24.0 and Linopy 0.5.5 Where the linopy model expects customized dimension names but PyPSA is providing non-customized ones.

  1. Environment Setup • Created conda environment 247-env with Python 3.12 • Downgraded PyPSA from 0.35.1 to 0.24.0 for compatibility with legacy network data • Current package versions: • PyPSA: 0.24.0 • Linopy: 0.5.5 (may be incompatible) • Pandas: 2.2.3

  2. Code Changes Made

A. scripts/_helpers.py

• Fixed override_component_attrs() function to match PyPSA 0.24.0 DataFrame structure • Changed column structure from 9 columns to 5 columns: ['type', 'unit', 'default', 'description', 'status'] • Removed deprecated pypsa.descriptors.Dict usage and replaced with regular dict + temporary network access

B. scripts/solve_network.py

• Restored override_component_attrs parameter in pypsa.Network() calls (lines 1661 and network loading) • Reverted mremove back from remove since PyPSA 0.24.0 supports both methods • Removed force_dim_names=False parameter from n.optimize.create_model() call

C. scripts/summarise_network.py

• Restored override_component_attrs parameter in pypsa.Network() call

Current Bugs/Issues

  1. Linopy Dimension Names Error (CRITICAL)
ValueError: Added data contains non-customized dimension names. This is not allowed when setting `force_dim_names` to True.

• Location: linopy/model.py:384 during define_nodal_balance_constraints • Root cause: Incompatible Linopy version (0.5.5) with PyPSA 0.24.0's expectations • Status: Unresolved

  1. Network Data Compatibility • Network files appear to be built with "PyPSA version 0.0.0" (seen in earlier errors) • May require network regeneration or different PyPSA version

Unknown Information Needed

  1. Package Version Compatibility Matrix • What exact versions of PyPSA, Linopy, and other dependencies are required? • Is there a tested combination that works with this codebase?

  2. Network Data Requirements • What PyPSA version were the input network files (elec_s_37_lv1.0__H-B-solar+p3_.nc) generated with? • Do these files need to be regenerated for PyPSA 0.24.0?

  3. Linopy Configuration • Is force_dim_names=True set somewhere in the codebase or PyPSA defaults? • How should dimension naming be handled in PyPSA 0.24.0 + Linopy 0.5.5?

  4. Alternative Solutions • Should we use a different PyPSA version (e.g., 0.21.x, 0.22.x)? • Are there known working dependency combinations for this 247-cfe codebase?

GitHub Issue Content

## Package Compatibility Issue with 247-cfe Workflow

### Environment
- OS: macOS 
- Python: 3.12
- PyPSA: 0.24.0 (downgraded from 0.35.1)
- Linopy: 0.5.5

### Error

ValueError: Added data contains non-customized dimension names. This is not allowed when setting force_dim_names to True.

### Questions
1. What are the exact tested/supported versions of PyPSA, Linopy, and other dependencies?
2. Are the input network files compatible with PyPSA 0.24.0, or do they need regeneration?
3. Where is `force_dim_names=True` being set, and how should it be configured?
4. Is there a requirements.txt or environment.yml with known working versions?

### Context
Attempting to run the 247-cfe workflow with legacy network data files. Made compatibility changes for PyPSA 0.24.0 but encountering Linopy dimension naming conflicts.

The core issue appears to be a version compatibility problem between PyPSA 0.24.0 and Linopy 0.5.5, where the linopy model expects customized dimension names but PyPSA is providing non-customized ones.

MaykThewessen avatar Jul 24 '25 08:07 MaykThewessen