Skip to content

Software

python-can

From github.com/hardbyte/python-can (opens in a new tab)

  • Robot arms and industry
  • Library
  • LGPL-3.0-only

A Python library giving developers common abstractions for Controller Area Network (CAN) buses, with utilities to send and receive messages across many hardware backends.

Facts

GitHub stars
1,627read on 28 Nov 2026
Last update
28 Nov 2026Newest commit on main
Maintenance
Activea commit in the last 90 days
Difficulty
Intermediate

Checked on GitHub on 28 Nov 2026.

Licenses

Code
LGPL-3.0-only (opens in a new tab)

Read by Robotheca from LICENSE.txt (opens in a new tab) (LGPL-3.0-only) at commit 6ecdddd (opens in a new tab), on 28 Nov 2026.

Commercial use
Yes

Copyleft: Modified source must be published.

At a glance

What it is
  • Provides common abstractions over many different CAN hardware devices and backends.
  • Supports sending, receiving, and periodically sending messages, with normal and extended arbitration IDs.
  • Supports CAN FD.
  • Includes many loggers and readers for recording and replaying bus traffic in several file formats.
  • Offers in-kernel or in-hardware message filtering on supported interfaces.
  • Includes command line tools for working with CAN buses.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
Used by AIRA, CocoNuts and Berkeley Humanoid Lite Arm (BHL v1.5).
Licence
LGPL-3.0-only. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's website (opens in a new tab)
Maintenance
Active, last commit on 28 Nov 2026.

Works with

3 robots on Robotheca

The robots on Robotheca that use it or can run it, each with how the link was found.

Use it

How to install it, in the creator's words: The project's website (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit 6ecdddd

Robotheca read the repository at two versions: the summary at b4f82ab and the facts and the README at 6ecdddd (read on 28 Nov 2026).

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.rst by @hardbyte, at commit 6ecdddd, under LGPL-3.0-only (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

python-can

|pypi| |conda| |python_implementation| |downloads| |downloads_monthly|

|docs| |github-actions| |coverage| |formatter|

.. |pypi| image:: https://img.shields.io/pypi/v/python-can.svg (opens in a new tab) :target: https://pypi.python.org/pypi/python-can/ (opens in a new tab) :alt: Latest Version on PyPi

.. |conda| image:: https://img.shields.io/conda/v/conda-forge/python-can (opens in a new tab) :target: https://github.com/conda-forge/python-can-feedstock (opens in a new tab) :alt: Latest Version on conda-forge

.. |python_implementation| image:: https://img.shields.io/pypi/implementation/python-can (opens in a new tab) :target: https://pypi.python.org/pypi/python-can/ (opens in a new tab) :alt: Supported Python implementations

.. |downloads| image:: https://static.pepy.tech/badge/python-can (opens in a new tab) :target: https://pepy.tech/project/python-can (opens in a new tab) :alt: Downloads on PePy

.. |downloads_monthly| image:: https://static.pepy.tech/badge/python-can/month (opens in a new tab) :target: https://pepy.tech/project/python-can (opens in a new tab) :alt: Monthly downloads on PePy

.. |formatter| image:: https://img.shields.io/badge/code%20style-black-000000.svg (opens in a new tab) :target: https://github.com/python/black (opens in a new tab) :alt: This project uses the black formatter.

.. |docs| image:: https://readthedocs.org/projects/python-can/badge/?version=stable (opens in a new tab) :target: https://python-can.readthedocs.io/en/stable/ (opens in a new tab) :alt: Documentation

.. |github-actions| image:: https://github.com/hardbyte/python-can/actions/workflows/ci.yml/badge.svg (opens in a new tab) :target: https://github.com/hardbyte/python-can/actions/workflows/ci.yml (opens in a new tab) :alt: Github Actions workflow status

.. |coverage| image:: https://coveralls.io/repos/github/hardbyte/python-can/badge.svg?branch=main (opens in a new tab) :target: https://coveralls.io/github/hardbyte/python-can?branch=main (opens in a new tab) :alt: Test coverage reports on Coveralls.io

The C\ ontroller A\ rea N\ etwork is a bus standard designed to allow microcontrollers and devices to communicate with each other. It has priority based bus arbitration and reliable deterministic communication. It is used in cars, trucks, boats, wheelchairs and more.

The can package provides controller area network support for Python developers; providing common abstractions to different hardware devices, and a suite of utilities for sending and receiving messages on a can bus.

The library currently supports CPython as well as PyPy and runs on Mac, Linux and Windows.

============================== =========== Library Version Python


2.x 2.6+, 3.4+ 3.x 2.7+, 3.5+ 4.0+ 3.7+ 4.3+ 3.8+ 4.6+ 3.9+ main branch 3.11+ ============================== ===========

Features
  • common abstractions for CAN communication
  • support for many different backends (see the docs <https://python-can.readthedocs.io/en/stable/interfaces.html>__)
  • receiving, sending, and periodically sending messages
  • normal and extended arbitration IDs
  • CAN FD <https://en.wikipedia.org/wiki/CAN_FD>__ support
  • many different loggers and readers supporting playback: ASC (CANalyzer format), BLF (Binary Logging Format by Vector), MF4 (Measurement Data Format v4 by ASAM), TRC, CSV, SQLite, and Canutils log
  • efficient in-kernel or in-hardware filtering of messages on supported interfaces
  • bus configuration reading from a file or from environment variables
  • command line tools for working with CAN buses (see the docs <https://python-can.readthedocs.io/en/stable/scripts.html>__)
  • more
Example usage

pip install python-can

.. code:: python

# import the library
import can

# create a bus instance using 'with' statement,
# this will cause bus.shutdown() to be called on the block exit;
# many other interfaces are supported as well (see documentation)
with can.Bus(interface='socketcan',
              channel='vcan0',
              receive_own_messages=True) as bus:

   # send a message
   message = can.Message(arbitration_id=123, is_extended_id=True,
                         data=[0x11, 0x22, 0x33])
   bus.send(message, timeout=0.2)

   # iterate over received messages
   for msg in bus:
       print(f"{msg.arbitration_id:X}: {msg.data}")

   # or use an asynchronous notifier
   notifier = can.Notifier(bus, [can.Logger("recorded.log"), can.Printer()])

You can find more information in the documentation, online at python-can.readthedocs.org <https://python-can.readthedocs.org/en/stable/>__.

Discussion

If you run into bugs, you can file them in our issue tracker <https://github.com/hardbyte/python-can/issues>__ on GitHub.

Stackoverflow <https://stackoverflow.com/questions/tagged/can+python>__ has several questions and answers tagged with python+can.

Wherever we interact, we strive to follow the Python Community Code of Conduct <https://www.python.org/psf/codeofconduct/>__.

Contributing

See doc/development.rst <doc/development.rst>__ for getting started.

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.