skillfed

python-can

Controller Area Network interface module for Python

python-can v4.6.1 5.2M downloads/30d#2,142 on PyPI1,582
Copyleft license LGPL-3.0-only Active released

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-can

uv

uv add python-can

poetry

poetry add python-can

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Information TechnologyIntended Audience :: ManufacturingIntended Audience :: Telecommunications IndustryNatural Language :: EnglishOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Embedded SystemsTopic :: Software Development :: Embedded Systems :: Controller Area Network (CAN)Topic :: System :: Hardware :: Hardware DriversTopic :: System :: LoggingTopic :: System :: MonitoringTopic :: System :: NetworkingTopic :: Utilities

Tags

CAN bus communicationcontroller area network PythonCAN message sending receivingautomotive CAN interfaceCAN bus loggingembedded systems CANvehicle network communication
automotiveembedded-systemshardware-interface

More Utilities packages