Install & Compatibility
Where this runs
tested against v1.51.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
build_error
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 13.4s · import 0.000s · 391MB
408MB installed
● package 408MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
DiagramBuilder
✓ from pydrake.systems.framework import DiagramBuilder
Simulator
✓ from pydrake.systems.framework import Simulator
MultibodyPlant
✓ from pydrake.multibody.plant import MultibodyPlant
SceneGraph
✓ from pydrake.geometry import SceneGraph
AcrobotPlant
✓ from pydrake.examples.acrobot import AcrobotPlant
LogVectorOutput
✓ from pydrake.systems.primitives import LogVectorOutput
all
✓ from pydrake.all import *
✗ import drake
Python bindings are under the 'pydrake' namespace, not 'drake'.
This quickstart demonstrates a basic simulation of an Acrobot (a two-link pendulum) using Drake's `DiagramBuilder` and `Simulator`. It sets up the system, defines an initial state, simulates its dynamics, and logs the output.
import numpy as np
from pydrake.systems.framework import DiagramBuilder, Simulator
from pydrake.examples.acrobot import AcrobotPlant
from pydrake.systems.primitives import LogVectorOutput
# Create a DiagramBuilder
builder = DiagramBuilder()
# Add the Acrobot plant (a classic underactuated system)
acrobot = builder.AddSystem(AcrobotPlant())
# Add a logger to record the state of the Acrobot
logger = LogVectorOutput(acrobot.get_output_port(0), builder)
# Build the diagram, connecting the components
diagram = builder.Build()
# Create a simulator for the diagram
simulator = Simulator(diagram)
context = simulator.get_mutable_context()
# Set initial state: (theta1, theta2, theta1_dot, theta2_dot)
# e.g., inverted upright with a small perturbation
context.SetContinuousState([np.pi/2, 0.1, 0.0, 0.0])
# Simulate for 2 seconds
simulator.AdvanceTo(2.0)
# Retrieve and print some logged data (optional verification)
log = logger.FindLog(context)
time = log.sample_times()
positions = log.data()[:2, :]
velocities = log.data()[2:, :]
print(f"Simulation finished. Logged {len(time)} time steps.")
print(f"Initial positions: {positions[:, 0]}, Final positions: {positions[:, -1]}")
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pydrake'
The `drake` package or its Python bindings (`pydrake`) are not installed or not accessible in the current Python environment.
fixEnsure `drake` is installed in your active environment: `pip install drake`. If using a virtual environment, activate it first.
ImportError: libdrake.so: cannot open shared object file: No such file or directory
The operating system cannot locate Drake's shared C++ libraries at runtime. This often happens if Drake was installed in a non-standard location, or environment variables like `LD_LIBRARY_PATH` (Linux) / `DYLD_LIBRARY_PATH` (macOS) are not correctly set.
fixIf using a system-level installation, ensure your shell environment variables are correctly configured to point to Drake's `lib` directory (e.g., by sourcing the setup script). If using `pip install drake`, this error is less common but may indicate a corrupted installation or a missing system dependency.
RuntimeError: There are no solvers available for the specified mathematical program. You must build/install at least one supported solver.
Your Drake installation does not have access to any configured mathematical programming solvers required by the optimization problem you are trying to solve. `pip install drake` does not include proprietary solvers.
fixInstall and configure a compatible solver (e.g., IPOPT, SNOPT, Mosek, Gurobi) according to the Drake documentation (drake.mit.edu/solvers.html). This often involves a system-level installation or specific build flags for Drake.
AttributeError: 'DiagramBuilder' object has no attribute 'AddLeafSystem'
You are attempting to use an outdated method `AddLeafSystem` on `DiagramBuilder`. The correct method for adding a system to the builder is `AddSystem`.
fixReplace `builder.AddLeafSystem(...)` with `builder.AddSystem(...)`.
RuntimeError: Failed to find Drake installation at conventional locations...
You are attempting to use a C++ utility (like `drake-visualizer` or `meshcat-server`) that is not included with `pip install drake`, or your system-level Drake installation path is not discoverable.
fixThe `pip install drake` package does *not* include C++ tools like `drake-visualizer`. To use such tools, you must install Drake via its pre-compiled binaries or build from source, then ensure your environment variables are correctly sourced to make the installation discoverable.
Upgrade
Version history
1.54.0latest on PyPI · released Jun 12, 2026
Audit
Dependencies
No dependency data recorded yet.