smbus2
smbus2 is a drop-in replacement for smbus-cffi/smbus-python in pure Python
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 smbus2uv
uv add smbus2poetry
poetry add smbus2Installing 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
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
Adafruit-PureIOProvides pure Python access to Linux I2C and…
permissive · top 15,000 on PyPI
ft4222Provides Python bindings to LibFT4222, enabling…
permissive · top 15,000 on PyPI
adafruit-circuitpython-busdeviceProvides I2CDevice and SPIDevice helper classes…
permissive · top 15,000 on PyPI
spidevProvides Python bindings to interact with SPI…
permissive · top 15,000 on PyPI
pyftdiPyFtdi provides a pure-Python user-space driver…
permissive · top 15,000 on PyPI
libusbsioProvides a Python wrapper around NXP's…
permissive · top 15,000 on PyPI
python-canProvides Python abstractions and utilities for…
copyleft · top 5,000 on PyPI
python-ipmiPure Python library for communicating with…
copyleft · top 15,000 on PyPI
cobsEncodes and decodes data using Consistent…
permissive · top 15,000 on PyPI
pure-pcapy3Pure-Python implementation of the pcapy API for…
permissive · top 15,000 on PyPI