skillfed

smbus2

smbus2 is a drop-in replacement for smbus-cffi/smbus-python in pure Python

smbus2 v0.6.1 1.1M downloads/30d#4,417 on PyPI271
Permissive license MIT Active released

What it is and what it does

smbus2 is a pure Python implementation of the SMBus and I2C protocols for Linux, designed as a drop-in replacement for the older C-based smbus bindings. It provides a familiar interface to users of the original smbus library while adding support for more complete I2C functionality, including combined read/write transactions with repeated start conditions and Packet Error Checking (PEC).

The package handles standard SMBus operations like reading and writing bytes, words, and blocks of data, as well as lower-level I2C transactions through the i2c_rdwr interface. It works across Python 2.7 and modern Python 3 versions, has no external runtime dependencies, and is designed for embedded systems and hardware interfacing tasks where direct I2C communication is needed.

Use it for:

  • Read sensor data from I2C-connected devices on a Raspberry Pi or other Linux single-board computer.
  • Write configuration or control data to I2C peripherals like EEPROM, GPIO expanders, or motor controllers.
  • Perform combined I2C transactions requiring a write followed by a read with no stop bit between operations.
  • Access I2C devices with data blocks larger than the standard SMBus 32-byte limit using i2c_rdwr.
  • Replace legacy smbus bindings in existing Python projects without changing application logic.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

smbus2 provides pure Python I2C/SMBus communication for Linux devices, replacing the C-based smbus bindings with a compatible interface that supports both basic SMBus operations and advanced I2C transactions.

Yes. smbus2 is actively maintained, has no dependencies, installs easily, carries no security vulnerabilities, and is the standard choice for I2C communication in Python on Linux. Install it if you need to communicate with I2C devices; it is low-risk and widely used in embedded and IoT projects.

Install

smbus2 on PyPI

pip

pip install smbus2

uv

uv add smbus2

poetry

poetry add smbus2

Installing smbus2

Before you install

Low install friction with no runtime dependencies and a pure Python wheel distribution. Actively maintained with recent releases and a stable repository.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.

Quickstart

from smbus2 import SMBus

with SMBus(1) as bus:
    byte_value = bus.read_byte_data(0x50, 0)
    print(byte_value)

Requires a Linux system with I2C support and access to /dev/i2c-* device files; does not work on Windows or macOS.

Verify before relying

  • Whether the package requires root or special permissions to access /dev/i2c-* device files on Linux systems.
  • Performance characteristics compared to the original C-based smbus bindings for high-frequency I2C operations.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 127 days since the last release
Last repo commit
First released
Downloads 1,064,165/month — #4,417 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: smbus2-0.6.1-py2.py3-none-any.whl

Keywords: smbus, smbus2, python, i2c, raspberrypi, linux

Development Status :: 4 - BetaLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Utilities

Tags

i2c communication pythonsmbus python libraryraspberry pi i2clinux i2c interfacesmbus replacement pure pythoni2c read write transactionsembedded linux i2c
i2c-hardwareembedded-linuxraspberry-pi

More Utilities packages