nashpy
A library with algorithms on 2 player games.
What it is and what it does
Nashpy is a Python library for analyzing two-player strategic games. It implements a range of algorithms to find Nash equilibria—the stable strategy profiles where neither player can improve by unilaterally changing their strategy—and to simulate evolutionary dynamics like fictitious play and replicator dynamics. The library is built on numpy, scipy, and networkx, making it suitable for both teaching game theory and conducting research.
You define a game by providing two payoff matrices (one for each player), then call methods to compute equilibria or run simulations. The library includes support enumeration, vertex enumeration, the Lemke-Howson algorithm, fictitious play variants, replicator dynamics with and without mutation, Moran processes on interaction and replication graphs, and introspection dynamics. It is well-documented with both theory and how-to guides.
Use it for:
- Teaching game theory: use the documented algorithms and examples to illustrate Nash equilibria and strategic reasoning.
- Computing equilibria in two-player games: solve for mixed and pure strategy equilibria in bimatrix games.
- Simulating evolutionary game dynamics: model population-level strategy evolution using replicator dynamics or Moran processes.
- Analyzing repeated games: generate and analyze games derived from repeated interactions.
- Research in game-theoretic modeling: implement custom game-theoretic analyses with built-in algorithm support.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Nashpy computes Nash equilibria and simulates strategic interactions in two-player games using algorithms like support enumeration, vertex enumeration, Lemke-Howson, fictitious play, and replicator dynamics.
Yes, if you work with two-player game theory. Nashpy has low install friction, permissive licensing, no known vulnerabilities, and comprehensive algorithm coverage with good documentation. The aging maintenance status (281 days since last release) is a minor concern for a stable library but worth monitoring if you need active development or bug fixes.
Install
nashpy on PyPI
pip
pip install nashpyuv
uv add nashpypoetry
poetry add nashpyInstalling nashpy
Before you install
Low install friction with a pure-Python wheel and four standard scientific dependencies (numpy, scipy, networkx, deprecated). Last release was 281 days ago; the repository is active but aging.
License in practice
MIT license (permissive) means you can use, modify, and distribute Nashpy freely in commercial and private projects with minimal restrictions.
Quickstart
import nashpy as nash
A = [[1, 2], [3, 0]]
B = [[0, 2], [3, 1]]
game = nash.Game(A, B)
for eq in game.support_enumeration():
print(eq)
Requires Python 3.10 or later.
Verify before relying
- Whether the library scales efficiently to larger game matrices or more complex strategy spaces.
- Performance characteristics of different equilibrium-finding algorithms on realistic game sizes.
- Whether Moran process and replicator dynamics implementations are suitable for research-grade analysis.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — numpy, scipy, networkx, deprecated |
| Maintenance | aging — 281 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,603,610/month — #2,562 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nashpy-0.0.43-py3-none-any.whl
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
open-spielOpenSpiel provides game environments and…
permissive · top 15,000 on PyPI
glicko2Implements the Glicko-2 rating system, a…
permissive · top 15,000 on PyPI
trueskillImplements the TrueSkill rating algorithm to…
permissive · top 15,000 on PyPI
quanteconQuantEcon provides computational tools and…
unclear · top 15,000 on PyPI
chessA pure-Python chess library providing move…
copyleft · top 5,000 on PyPI
ale-pyale-py provides a Python interface to the Atari…
copyleft · top 15,000 on PyPI
pymunkPymunk is a 2D rigid body physics simulation…
permissive · top 15,000 on PyPI
kaggle-environmentsKaggle Environments provides a framework for…
unclear · top 15,000 on PyPI
openskillOpenskill is a multiplayer rating system that…
permissive · top 15,000 on PyPI