Box2D
Python Box2D
What it is and what it does
Box2D is a Python wrapper around the Box2D physics engine, a mature C++ library for simulating 2D rigid-body dynamics. It provides tools to create worlds, bodies, shapes (circles, polygons, line segments), and joints (revolute, prismatic, wheel, and others), making it suitable for building games, physics simulations, and interactive visualizations.
The package ships with a testbed containing dozens of example scenarios demonstrating collision handling, joint mechanics, and various physics phenomena. To visualize simulations, you pair Box2D with a rendering backend such as pygame, pyglet, or OpenCV. The library has no runtime dependencies—it's a self-contained binding—but installation requires a prebuilt wheel or a C++ compiler to build from source.
Use it for:
- Build 2D games with realistic physics-based movement, collisions, and joint constraints.
- Create physics simulations and educational demonstrations of mechanics, gravity, and collision behavior.
- Prototype interactive physics-based visualizations paired with pygame or pyglet for rendering.
- Implement ragdoll or articulated-body systems using revolute and prismatic joints.
- Test collision detection and response algorithms in a well-established physics framework.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Box2D is a Python binding to the Box2D C++ physics engine, providing 2D rigid-body simulation for games and physics-based applications with support for multiple shape and joint types.
Yes, if you need a stable, proven 2D physics engine for games or simulations and can tolerate dormancy. Box2D is mature and widely used, with no known vulnerabilities and permissive licensing. However, the last release was in 2020 and maintenance is minimal—if you require active development, bug fixes for modern Python versions, or ongoing support, consider whether an actively maintained alternative better fits your timeline. For existing projects or prototypes, it remains reliable.
Install
box2d on PyPI
pip
pip install box2duv
uv add box2dpoetry
poetry add box2dInstalling Box2D
Before you install
Medium install friction due to compiled wheels; prebuilt binaries are available for recent Python versions across Windows, macOS, and Linux, but the package is dormant—last release was 2020-04-11 with minimal recent maintenance activity despite an active repository.
License in practice
Licensed under zlib (permissive), allowing use in commercial and proprietary projects with minimal restrictions; attribution is typically required but the license imposes no copyleft obligations.
Quickstart
pip install Box2D
import Box2D
from Box2D import b2World, b2BodyDef, b2CircleShape
world = b2World(gravity=(0, -10))
body_def = b2BodyDef(position=(0, 0))
body = world.CreateBody(body_def)
Requires a compiled wheel matching your Python version and platform; if no prebuilt wheel is available for your environment, installation will fail unless you can build from source (requires C++ compiler and development headers).
Verify before relying
- Whether prebuilt wheels are available for Python versions beyond those listed in friction evidence or for other architectures.
- Current state of the repository's build infrastructure and whether new wheels are being generated for recent Python releases.
- Whether the dormant status affects stability or introduces compatibility issues with modern Python ecosystems.
Package facts
| License | zlib (permissive) |
| Python support | not specified |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 2,316 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 97,059/month — #13,174 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: Box2D-2.3.10-cp27-cp27m-win32.whl; Box2D-2.3.10-cp310-cp310-macosx_10_9_x86_64.whl; Box2D-2.3.10-cp310-cp310-macosx_11_0_arm64.whl; Box2D-2.3.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; Box2D-2.3.10-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; Box2D-2.3.10-cp310-cp310-musllinux_1_2_i686.whl; Box2D-2.3.10-cp310-cp310-musllinux_1_2_x86_64.whl; Box2D-2.3.10-cp310-cp310-win32.whl; Box2D-2.3.10-cp310-cp310-win_amd64.whl; Box2D-2.3.10-cp311-cp311-macosx_10_9_x86_64.whl; Box2D-2.3.10-cp311-cp311-macosx_11_0_arm64.whl; Box2D-2.3.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; Box2D-2.3.10-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; Box2D-2.3.10-cp311-cp311-musllinux_1_2_i686.whl; Box2D-2.3.10-cp311-cp311-musllinux_1_2_x86_64.whl; Box2D-2.3.10-cp311-cp311-win32.whl; Box2D-2.3.10-cp311-cp311-win_amd64.whl; Box2D-2.3.10-cp312-cp312-macosx_10_13_x86_64.whl; Box2D-2.3.10-cp312-cp312-macosx_11_0_arm64.whl; Box2D-2.3.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Tags
More Graphics packages
Pillow adds image processing capabilities to…
permissive · top 100 on PyPI
fonttoolsfonttools manipulates font files in multiple…
permissive · top 1,000 on PyPI
matplotlib-inlineEnables matplotlib figures to display inline…
permissive · top 1,000 on PyPI
pymupdfPyMuPDF extracts, renders, converts, and…
agpl · top 1,000 on PyPI
pypdfium2pypdfium2 is a Python binding to PDFium that…
permissive · top 1,000 on PyPI
altairAltair is a declarative Python library for…
permissive · top 1,000 on PyPI
pymunkPymunk is a 2D rigid body physics simulation…
permissive · top 15,000 on PyPI
pybulletPyBullet provides physics simulation, robotics…
permissive · top 15,000 on PyPI
Panda3DPanda3D is a 3D game engine with Python…
permissive · top 15,000 on PyPI
chessA pure-Python chess library providing move…
copyleft · top 5,000 on PyPI
ursinaUrsina is a Python game engine built on Panda3D…
permissive · top 15,000 on PyPI
mujocoMuJoCo is a physics simulation engine with…
permissive · top 5,000 on PyPI
quadrantsQuadrants is a high-performance compiler that…
permissive · top 15,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
dm-controldm_control provides Python bindings to the…
permissive · top 15,000 on PyPI
imguiPython bindings for the dear imgui C++ library,…
permissive · top 15,000 on PyPI