pymunk
Pymunk is a easy-to-use pythonic 2D physics library
What it is and what it does
Pymunk wraps the Chipmunk2D physics engine in a Pythonic API, letting you simulate 2D rigid bodies, collisions, and constraints without writing C code. You create a Space (simulation container), add bodies with shapes, set gravity and other properties, then step the simulation forward in time. It's designed to integrate with game frameworks or run standalone for physics demos and scientific simulations.
The library has been actively maintained since 2007 and is used in published research, game competition winners, and autonomous vehicle simulations. It requires Python 3.9 or later and depends only on cffi; binary wheels are available for Windows, macOS, and Linux on multiple architectures, making installation straightforward via pip.
Use it for:
- Add realistic gravity, collisions, and rigid body dynamics to a game without implementing physics from scratch
- Simulate mechanical systems, pendulums, or constraint-based structures for research or educational demonstrations
- Prototype 2D physics interactions in a notebook or standalone script for algorithm validation
- Build interactive physics sandboxes where users can create and manipulate bodies and constraints in real time
- Test collision detection and response logic for game level design or agent navigation
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Pymunk is a 2D rigid body physics simulation library for Python, providing collision detection, body dynamics, and constraint solving built on the Chipmunk2D engine.
Yes. Pymunk is a mature, actively maintained library with no known vulnerabilities, permissive MIT licensing, and a single lightweight dependency. Install friction is medium but manageable via prebuilt wheels. It is the right choice if you need 2D rigid body physics in Python—especially for games or simulations—and want to avoid implementing collision and constraint solvers yourself.
Install
pymunk on PyPI
pip
pip install pymunkuv
uv add pymunkpoetry
poetry add pymunkInstalling pymunk
Before you install
Medium install friction due to compiled wheels for multiple platforms and Python versions. Active maintenance with recent release (58 days ago) and 1062 repository stars. Single runtime dependency (cffi) is lightweight.
License in practice
MIT license permits commercial and private use with minimal restrictions—suitable for games, simulations, and research projects without licensing concerns.
Quickstart
pip install pymunk
import pymunk
space = pymunk.Space()
space.gravity = 0, -981
body = pymunk.Body()
body.position = 50, 100
poly = pymunk.Poly.create_box(body)
poly.mass = 10
space.add(body, poly)
space.step(0.02)
Requires Python 3.9 or later; binary wheels available for common platforms, but compilation from source requires a C compiler.
Verify before relying
- Whether performance is suitable for real-time game loops at typical frame rates
- Stability and API compatibility guarantees across minor version updates
- Whether constraint types and joint options cover specific simulation needs
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — cffi |
| Maintenance | actively maintained — 58 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 379,140/month — #7,111 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pymunk-7.3.0-cp310-cp310-macosx_10_9_x86_64.whl; pymunk-7.3.0-cp310-cp310-macosx_11_0_arm64.whl; pymunk-7.3.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pymunk-7.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pymunk-7.3.0-cp310-cp310-musllinux_1_2_aarch64.whl; pymunk-7.3.0-cp310-cp310-musllinux_1_2_x86_64.whl; pymunk-7.3.0-cp310-cp310-win32.whl; pymunk-7.3.0-cp310-cp310-win_amd64.whl; pymunk-7.3.0-cp311-cp311-macosx_10_9_x86_64.whl; pymunk-7.3.0-cp311-cp311-macosx_11_0_arm64.whl; pymunk-7.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pymunk-7.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pymunk-7.3.0-cp311-cp311-musllinux_1_2_aarch64.whl; pymunk-7.3.0-cp311-cp311-musllinux_1_2_x86_64.whl; pymunk-7.3.0-cp311-cp311-win32.whl; pymunk-7.3.0-cp311-cp311-win_amd64.whl; pymunk-7.3.0-cp312-cp312-macosx_10_13_x86_64.whl; pymunk-7.3.0-cp312-cp312-macosx_11_0_arm64.whl; pymunk-7.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pymunk-7.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Keywords: pygame, 2d, physics, rigid body
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
Box2DBox2D is a Python binding to the Box2D C++…
permissive · top 15,000 on PyPI
pybulletPyBullet provides physics simulation, robotics…
permissive · top 15,000 on PyPI
libpinocchiolibpinocchio provides efficient rigid body…
permissive · top 15,000 on PyPI
pinPython interface to a C++ rigid-body dynamics…
permissive · top 5,000 on PyPI
mujocoMuJoCo is a physics simulation engine with…
permissive · top 5,000 on PyPI
mujoco-warpGPU-accelerated physics simulation for robotics…
permissive · top 15,000 on PyPI
pygletpyglet is a cross-platform windowing and…
unclear · top 5,000 on PyPI
quimbQuimb provides Python tools for quantum…
permissive · top 15,000 on PyPI
newtonNewton is a GPU-accelerated physics simulation…
permissive · top 15,000 on PyPI
nashpyNashpy computes Nash equilibria and simulates…
permissive · top 5,000 on PyPI