IRENA FlexTool is an energy and power systems model for understanding the role of variable power generation in future energy systems. It performs capacity expansion planning as well as operational planning.
[!NOTE] The previous
masterbranch is deprecated and no longer updated —mainis now FlexTool. If you still run FlexTool frommaster, migrate with a fresh parallel install (separate directory and venv); see Installation so your existing setup is left untouched.
What's new
- A lot faster. The model build and pre-processing now run as pure Python instead of the previous GLPSOL-based text pre-processing and AMPL-style model translation. There is no LP file written to disk and re-read between build and solve.
- Automatic problem scaling. The
polar-highmatrix layer automatically scales the optimisation problem before it reaches the solver. Better numerical conditioning often speeds up the HiGHS solve considerably — sometimes dramatically — so total run time usually improves well beyond the faster build alone. The solver is still HiGHS; the gain comes from handing it a better-conditioned problem. - A new, easy-to-use interface. The FlexTool GUI is a standalone
application (
python -m flextool.gui) that manages projects and input sources, runs scenarios, and lets you browse the results — a result viewer reads outputs directly and supports single-scenario, scenario-comparison, and network-graph views with keyboard navigation. See the FlexTool GUI guide. - Spine Toolbox is still a parallel interface. Advanced users who build multi-tool workflows or integrate FlexTool with other models can keep using the Spine Toolbox workflow.
- The same model and data. Existing input databases continue to work; the change is in how the matrix is generated and solved, not in the model formulation.
This is IRENA FlexTool v4 (see the current version in CHANGELOG.md). Report any bugs or difficulties in the issue tracker. The previous version of IRENA FlexTool can be found in https://www.irena.org/energytransition/Energy-System-Models-and-Data/IRENA-FlexTool.
Under the hood: Rust-based matrix generation
FlexTool is a thin Python layer over a Rust engine. It reads its input data and
builds the optimisation matrix as polars DataFrames via
polar-high, then solves with
HiGHS. Variables and parameters are polars frames, so
multiplications become joins and aggregations become group-bys — the heavy
coefficient work runs inside polars' Rust core rather than as per-coefficient
Python objects, and the matrix goes straight to HiGHS through highspy with no
intermediate LP/MPS file. polar-high is a general-purpose, domain-free
modelling layer published separately (Apache-2.0, pip install polar-high); it
also applies the automatic problem scaling noted above, and its
benchmark compares it
against linopy and Pyomo on the same HiGHS solver.
Installation
Check your Python (and possibly install it)
FlexTool requires Python 3.11+.
Open a terminal (Windows: Command Prompt or PowerShell; macOS: Terminal; Linux: your shell) and check which Python you have:
| Platform | Command |
|---|---|
| Windows | py --version (falls back to python --version) |
| macOS / Linux | python3 --version |
The output looks like Python 3.12.4. If the command is not found, prints
something below 3.11, or (on Windows) opens the Microsoft Store, install Python
from https://www.python.org/downloads/ — on Windows tick
"Add python.exe to PATH" in the installer. Then close and reopen the
terminal so the new PATH takes effect.
On Windows, use
pyin place ofpythonin the commands below ifpythonis not recognised. If several versions are installed,py -3.11 --version(or-3.12, …) picks a specific one, andpy -0lists them all. On macOS/Linux,pythonoften means Python 2 or does not exist at all, so usepython3. Inside an activated virtual environment, plainpythonalways means that environment's Python on every platform.
Install from PyPI (recommended)
Install FlexTool into a virtual environment to keep its packages separate from
other Python applications. If you want to install into the base Python (perhaps
because you do not otherwise use Python), just run the last pip install
command from below.
python -m venv .venv # Windows: py -m venv .venv
# macOS/Linux: python3 -m venv .venv
# activate — Windows PowerShell: .\.venv\Scripts\Activate.ps1
# Windows CMD: .\.venv\Scripts\activate.bat
# Linux / macOS: . .venv/bin/activate
python -m pip install --upgrade pip
pip install "flextool[toolbox,viewer]"
The [toolbox,viewer] extras add the Spine Toolbox database editor (for editing
and viewing input and result databases) and the network-graph result view. To
install without Spine Toolbox (edit/view data in a spreadsheet only), you can
use plain pip install flextool.
Your prompt should now show (.venv). Verify with python --version — it
should report 3.11 or newer.
(If PowerShell blocks the activate script, run once per user:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned.)
Launch the FlexTool GUI:
flextool
— equivalently python -m flextool.gui. The GUI creates and manages your
projects and input databases; to seed the bundled template and example
databases (handy for the CLI or Spine Toolbox workflows) run flextool-update.
Install from source (developers / latest main)
To participate in FlexTool development — or to run the not-yet-released main
— clone the repo and install it editable:
git clone https://github.com/irena-flextool/flextool.git
cd flextool
python -m venv .venv
.\.venv\Scripts\Activate.ps1 # Linux / macOS: . .venv/bin/activate
python -m pip install --upgrade pip
pip install -e .
The editable install picks up source changes on git pull; re-run
pip install -e . only when a dependency pin in pyproject.toml changes.
Update FlexTool:
# If using virtual environment (venv), then activate venv first:
# Windows PowerShell: .\.venv\Scripts\Activate.ps1
# Windows CMD: .\.venv\Scripts\activate.bat
# Linux / macOS: . .venv/bin/activate
pip install --upgrade flextool
Documentation and installation
[!IMPORTANT] Installation, user guide and documentation can be found at: https://irena-flextool.github.io/flextool/.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flextool-4.0.1.tar.gz.
File metadata
- Download URL: flextool-4.0.1.tar.gz
- Upload date:
- Size: 2.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34ad6850d8b7513543c515c2771aae1c351f3f5851af9473f41287fa88223f9c
|
|
| MD5 |
14d29b8d5eaf496700202b75e10dae26
|
|
| BLAKE2b-256 |
3b36f81b9acb015c111c567adbd7c69780f6c0ffcb763d8627e05e16b460c60c
|
Provenance
The following attestation bundles were made for flextool-4.0.1.tar.gz:
Publisher:
publish.yml on irena-flextool/flextool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flextool-4.0.1.tar.gz -
Subject digest:
34ad6850d8b7513543c515c2771aae1c351f3f5851af9473f41287fa88223f9c - Sigstore transparency entry: 2685045946
- Sigstore integration time:
-
Permalink:
irena-flextool/flextool@8744e9fc3b47cdb5f847586b6cd3d26979795839 -
Branch / Tag:
refs/tags/v4.0.1 - Owner: https://github.com/irena-flextool
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8744e9fc3b47cdb5f847586b6cd3d26979795839 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flextool-4.0.1-py3-none-any.whl.
File metadata
- Download URL: flextool-4.0.1-py3-none-any.whl
- Upload date:
- Size: 2.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f423d89884a44c4ff4d2a20d04092681202438c6b20a25ba5bbda24610a1728
|
|
| MD5 |
a114065d2d503180833a78e95f996502
|
|
| BLAKE2b-256 |
a4e8a76a3bb8da82f03676603a0413724b8ef495a9db2b0472aa136de380d28f
|
Provenance
The following attestation bundles were made for flextool-4.0.1-py3-none-any.whl:
Publisher:
publish.yml on irena-flextool/flextool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flextool-4.0.1-py3-none-any.whl -
Subject digest:
3f423d89884a44c4ff4d2a20d04092681202438c6b20a25ba5bbda24610a1728 - Sigstore transparency entry: 2685045961
- Sigstore integration time:
-
Permalink:
irena-flextool/flextool@8744e9fc3b47cdb5f847586b6cd3d26979795839 -
Branch / Tag:
refs/tags/v4.0.1 - Owner: https://github.com/irena-flextool
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8744e9fc3b47cdb5f847586b6cd3d26979795839 -
Trigger Event:
push
-
Statement type: