python-can
Controller Area Network interface module for Python
What it is and what it does
python-can is a library that abstracts CAN bus communication for Python developers, allowing them to send and receive messages on Controller Area Network interfaces used in automotive, industrial, and embedded systems. It provides a unified API across multiple hardware backends and operating systems (Linux, macOS, Windows), handling the low-level details of different CAN controllers and protocols.
The library supports standard and extended arbitration IDs, CAN FD (flexible data rate), message filtering, and multiple logging formats (ASC, BLF, MF4, CSV, SQLite). It includes command-line tools for bus inspection and a notifier system for asynchronous message handling. With active maintenance, broad platform support, and a stable API, it serves as the primary Python interface for CAN bus work in automotive and embedded applications.
Use it for:
- Develop automotive diagnostic tools or vehicle telemetry systems that read CAN messages from car networks.
- Log and replay CAN bus traffic for testing and debugging embedded systems in manufacturing or robotics.
- Build real-time monitoring dashboards for industrial equipment or wheelchairs that communicate over CAN.
- Integrate CAN communication into Python-based control systems for boats, trucks, or other vehicles.
- Automate testing of CAN-based hardware by sending and validating message sequences.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python abstractions and utilities for Controller Area Network (CAN) communication, supporting multiple hardware backends and message logging formats.
Yes. python-can is a mature, actively maintained library with low install friction, no known vulnerabilities, and broad hardware support. The LGPL-3.0 copyleft license requires derivative works to be open-source, which is a constraint for proprietary applications but standard for embedded systems work. Install it if you need to communicate with CAN buses from Python.
Install
python-can on PyPI
pip
pip install python-canuv
uv add python-canpoetry
poetry add python-canInstalling python-can
Before you install
Low install friction with three lightweight runtime dependencies (wrapt, packaging, typing_extensions). Active maintenance with recent commits and a stable production release cycle.
License in practice
Licensed under LGPL-3.0-only (copyleft). Derivative works and modifications must be distributed under the same license; proprietary applications linking this library may face licensing constraints.
Quickstart
pip install python-can
import can
with can.Bus(interface='socketcan', channel='vcan0') as bus:
message = can.Message(arbitration_id=123, data=[0x11, 0x22, 0x33])
bus.send(message)
for msg in bus:
print(f"{msg.arbitration_id:X}: {msg.data}")
Requires Python 3.9 or later. Hardware interface availability depends on the target platform (socketcan on Linux, PCAN on Windows, etc.) and installed drivers.
Verify before relying
- Whether all advertised backends (socketcan, PCAN, Vector, Kvaser, etc.) are equally well-maintained and tested in version 4.6.1.
- Performance characteristics and latency guarantees for real-time CAN communication on different platforms.
- Compatibility with specific CAN hardware devices and whether driver installation is required beyond the Python package.
Package facts
| License | LGPL-3.0-only (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — wrapt, packaging, typing_extensions |
| Maintenance | actively maintained — 367 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,201,381/month — #2,142 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_can-4.6.1-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
canopenA Python implementation of the CANopen standard…
permissive · top 5,000 on PyPI
dronecanImplements the DroneCAN v1 protocol stack in…
permissive · top 15,000 on PyPI
spidevProvides Python bindings to interact with SPI…
permissive · top 15,000 on PyPI
cantoolsCantools parses automotive CAN bus database…
permissive · top 5,000 on PyPI
icsneopyicsneopy is a Python binding for Intrepid…
unclear · top 15,000 on PyPI
smbus2smbus2 provides pure Python I2C/SMBus…
permissive · top 5,000 on PyPI
azure-servicebusAzure Service Bus client library for Python…
unclear · top 1,000 on PyPI
adafruit-circuitpython-busdeviceProvides I2CDevice and SPIDevice helper classes…
permissive · top 15,000 on PyPI
ovos-bus-clientProvides a Python client to connect to…
permissive · top 15,000 on PyPI
BAC0BAC0 is an asynchronous Python scripting…
copyleft · top 15,000 on PyPI