skillfed

nashpy

A library with algorithms on 2 player games.

nashpy v0.0.43 3.6M downloads/30d#2,562 on PyPI378
Permissive license AGING released

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 nashpy

uv

uv add nashpy

poetry

poetry add nashpy

Installing 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

License :: OSI Approved :: MIT License

Tags

nash equilibrium solvertwo player game theorygame theory algorithmsstrategic interaction simulationbimatrix game solverequilibrium computationgame theoretic analysis
game-theoryequilibrium-computationeducational

More Mathematics packages