skillfed

pypsa

Python for Power Systems Analysis

pypsa v1.2.4 106.9K downloads/30d#12,635 on PyPI2,104
Permissive license MIT License Copyright (c) 2015-2026 PyPSA contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) Active released

What it is and what it does

PyPSA is an open-source framework for modeling and optimizing modern power and energy systems. It handles conventional generators with unit commitment, variable renewable generation (wind and solar), hydro-electricity, inter-temporal storage, and coupling between energy sectors (electricity, heat, hydrogen). The framework supports multiple analysis modes: economic dispatch for short-term market simulation, linear optimal power flow for least-cost dispatch respecting network constraints, capacity expansion planning for long-term infrastructure investment decisions, and stochastic optimization for uncertainty. It is built on pandas for data storage, scipy and numpy for linear algebra, linopy for optimization problem formulation, and networkx for network calculations.

PyPSA is designed for researchers, planners, and utilities who need transparent, fast analysis of large networks over long time series. It includes visualization via matplotlib, seaborn, and plotly, and supports both AC and DC power flow analysis with optional loss approximations. The framework scales well with problem size and provides extensive documentation with tutorials and examples.

Use it for:

  • Model and optimize dispatch of a regional electricity grid with mixed renewable and conventional generation over a year of hourly data
  • Plan long-term capacity expansion for generation, storage, and transmission infrastructure to meet decarbonization targets
  • Analyze security-constrained optimal power flow to ensure system reliability under line outage contingencies
  • Simulate integrated energy systems coupling electricity, heating, and hydrogen production with sector-specific technologies
  • Explore near-optimal system configurations using modelling-to-generate-alternatives to understand feasible design trade-offs

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PyPSA is a Python framework for optimizing and simulating power and energy systems, supporting economic dispatch, optimal power flow, capacity expansion planning, and sector-coupling with multiple energy carriers.

Yes. PyPSA is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and installs with low friction. It is well-suited for power system research, planning, and operational analysis. Install it if you need to model or optimize energy systems at any scale from local microgrids to continental networks.

Install

pypsa on PyPI

pip

pip install pypsa

uv

uv add pypsa

poetry

poetry add pypsa

Installing pypsa

Before you install

Low install friction with a pure-wheel distribution. Active maintenance with a release 48 days ago and last commit on 2026-08-14. Supports Python 3.11 through 3.14. Depends on 18 runtime packages including scipy, pandas, networkx, and linopy for optimization.

License in practice

MIT License permits unrestricted commercial and private use, modification, and distribution with minimal restrictions. You may use PyPSA in proprietary projects without licensing concerns.

Quickstart

import pypsa

n = pypsa.Network()
n.add("Bus", "mybus")
n.add("Load", "myload", bus="mybus", p_set=100)
n.add("Generator", "mygen", bus="mybus", p_nom=100, marginal_cost=20)
n.optimize()
n.plot()

Requires Python 3.11 or later. Optimization requires an external solver; HiGHS is installed by default, but Gurobi, FICO Xpress, GLPK, or CBC can be used.

Verify before relying

  • Whether the default HiGHS solver is sufficient for your problem scale or if commercial solvers are needed for performance
  • Specific solver compatibility and licensing requirements for your use case

Package facts

License MIT License Copyright (c) 2015-2026 PyPSA contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 18 — numpy, scipy, pandas, xarray, netcdf4, linopy, matplotlib, plotly, pydeck, seaborn, geopandas, shapely, networkx, deprecation, validators, highspy, levenshtein, platformdirs
Maintenance actively maintained — 48 days since the last release
Last repo commit
First released
Downloads 106,863/month — #12,635 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pypsa-1.2.4-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Typing :: Typed

Tags

power system optimizationenergy system modelingoptimal power flowcapacity expansion planningeconomic dispatchpower flow analysisenergy sector coupling
power-systemsenergy-optimizationsector-coupling

More Scientific/Engineering packages