Skip to main content

Installation

Requirements

System Requirements

  • Operating System: Linux / Windows / macOS
  • Python: 3.10, 3.11, 3.12, 3.13, or 3.14
  • Hardware: CAN interface (SocketCAN, PCAN) or serial adapter

Python Dependencies

The package automatically installs required dependencies:
  • ctypes (standard library)
  • dataclasses (standard library)

Install from PyPI

The recommended installation method:

Install Specific Version

Upgrade Existing Installation

Verify Installation

Quick Test

Check Version

Test CLI

Expected output:

Test Gateway Command

motorbridge wheel also installs a standalone gateway launcher:
-- is optional: motorbridge-gateway -- --help and motorbridge-gateway --help are equivalent.

WS Gateway Quick Start (3 Platforms)

Use motorbridge-gateway (the Python launcher for ws_gateway) directly after pip install.

A) Damiao serial bridge (dm-serial)

Ubuntu:
macOS:
Windows (PowerShell):

B) CAN path (auto/socketcan/pcan)

Ubuntu (SocketCAN):
macOS (PCBUSB runtime):
Windows (PCAN backend):
Notes:
  • dm-serial is Damiao-only.
  • For CAN path: Linux needs SocketCAN interface up (ip link set can0 up), Windows needs PEAK PCAN driver + PCANBasic.dll, macOS needs PCBUSB runtime.
  • CLI/Gateway now print platform-specific dependency hints before startup.
  • Keep default bind 127.0.0.1 for local usage. If exposing non-loopback addresses, set MOTORBRIDGE_WS_TOKEN and send it via x-motorbridge-token or Authorization: Bearer ....
macOS only (if dynamic library load fails):

Pre-release Versions (TestPyPI)

For testing bleeding-edge features before official release:
Pre-release versions may be unstable. Do not use in production.

Development Installation

From Source (Git)

Set Library Path (Source Builds Only)

If building from source without a packaged wheel:
Source builds require the Rust toolchain and compiling the libmotor_abi.so library first with cargo build -p motor_abi --release.
Isolate your installation using a virtual environment:

System CAN Setup

Before using the SDK, ensure your CAN interface is configured:

Linux (SocketCAN) software checks and bring-up

Windows (PCAN) software checks and bring-up

Recommended PowerShell (Admin) flow:

macOS (PCBUSB) software checks and bring-up

macOS (PCBUSB) driver/runtime install (if missing)

If libPCBUSB.dylib cannot be loaded, install PCBUSB first. System-wide install:
User-local fallback:

Serial Port Permissions (Linux, dm-serial)

For DM serial bridge transport:

Troubleshooting Installation

ImportError: cannot import name ‘Controller’

The ABI library cannot be found. Ensure:
  1. You installed from a wheel (not just copying source)
  2. libmotor_abi.so is in the package directory or LD_LIBRARY_PATH

Permission Denied on /dev/ttyACM0

CAN Interface Not Found

Windows PCAN runtime missing

If you see PCANBasic.dll missing:
  1. Install PEAK driver + PCAN-Basic runtime.
  2. Reopen terminal/IDE and retry.
  3. Prefer channels like can0@1000000 or can1@1000000.

macOS PCBUSB runtime missing

If you see libPCBUSB.dylib missing:
  1. Install PCBUSB runtime first.
  2. Ensure libPCBUSB.dylib is in a searchable path (for example /usr/local/lib).
  3. Reopen terminal and retry.

Next Steps