lmdb
Universal Python binding for the LMDB 'Lightning' Database
What it is and what it does
py-lmdb is a Python wrapper around the LMDB C library, a high-performance embedded key-value database that uses memory-mapped files for fast, efficient access. It allows you to store and retrieve binary data with ACID transaction support, making it suitable for applications that need a lightweight, durable local database without the overhead of a server process.
The package has been maintained since 2013 and currently supports Python 3.9 and later, including PyPy. It provides no runtime dependencies beyond the compiled LMDB library itself, so installation is straightforward on platforms with pre-built wheels. The library is commonly used in data-intensive applications, caching layers, and scenarios where you need fast, transactional access to structured data without running a separate database service.
Use it for:
- Building a local cache layer for machine learning pipelines or data processing workflows that need fast key-value lookups.
- Storing embeddings or feature vectors in a searchable, persistent format for similarity search or retrieval tasks.
- Implementing a lightweight session store or state management system for applications that don't require a full database server.
- Archiving or indexing large datasets where memory-mapped access provides performance benefits over traditional file I/O.
- Creating a transaction-safe local database for desktop or embedded applications with minimal external dependencies.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a Python binding to LMDB (Lightning Memory-Mapped Database), a fast key-value store based on memory-mapped files for efficient data access and storage.
Yes, if you need a fast, embedded key-value database with transaction support and have Python >= 3.9. The package is actively maintained, has no known vulnerabilities, and offers pre-built wheels for most platforms. Verify that the OLDAP-2.8 license is compatible with your use case before committing to production use.
Install
lmdb on PyPI
pip
pip install lmdbuv
uv add lmdbpoetry
poetry add lmdbInstalling lmdb
Before you install
Medium install friction due to compiled C extension wheels, but pre-built wheels are available for common platforms (macOS, Linux, Windows) and Python versions 3.10–3.13. Last release 33 days ago; repository is active with 747 stars.
License in practice
License treatment is unclear (OLDAP-2.8); review the repository's license file and terms before use in proprietary or redistributed software to confirm compatibility with your project.
Quickstart
import lmdb
env = lmdb.open('/path/to/db')
with env.begin(write=True) as txn:
txn.put(b'key', b'value')
with env.begin() as txn:
print(txn.get(b'key'))
Requires Python >= 3.9; compiled C extension requires a C compiler or pre-built wheel for your platform.
Verify before relying
- Specific performance characteristics (throughput, latency, memory overhead) compared to other embedded databases.
- Whether OLDAP-2.8 license is compatible with your intended use case (proprietary, commercial, or open-source redistribution).
- Concurrency model and transaction isolation guarantees under multi-process or multi-threaded access patterns.
Package facts
| License | OLDAP-2.8 (unclear) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 33 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,848,906/month — #2,216 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lmdb-2.3.0-cp310-cp310-macosx_10_9_x86_64.whl; lmdb-2.3.0-cp310-cp310-macosx_11_0_arm64.whl; lmdb-2.3.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; lmdb-2.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; lmdb-2.3.0-cp310-cp310-win_amd64.whl; lmdb-2.3.0-cp310-cp310-win_arm64.whl; lmdb-2.3.0-cp311-cp311-macosx_10_9_x86_64.whl; lmdb-2.3.0-cp311-cp311-macosx_11_0_arm64.whl; lmdb-2.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; lmdb-2.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; lmdb-2.3.0-cp311-cp311-win_amd64.whl; lmdb-2.3.0-cp311-cp311-win_arm64.whl; lmdb-2.3.0-cp312-cp312-macosx_10_13_x86_64.whl; lmdb-2.3.0-cp312-cp312-macosx_11_0_arm64.whl; lmdb-2.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; lmdb-2.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; lmdb-2.3.0-cp312-cp312-win_amd64.whl; lmdb-2.3.0-cp312-cp312-win_arm64.whl; lmdb-2.3.0-cp313-cp313-macosx_10_13_x86_64.whl; lmdb-2.3.0-cp313-cp313-macosx_11_0_arm64.whl
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
amulet-leveldbProvides a Cython wrapper around Mojang's…
unclear · top 15,000 on PyPI
tinydbTinyDB is a lightweight, pure-Python document…
permissive · top 5,000 on PyPI
ZODBZODB is an object-oriented database for Python…
unclear · top 15,000 on PyPI
plyvelPlyvel is a Python interface to LevelDB, a fast…
permissive · top 5,000 on PyPI
ase-db-backendsProvides database backend implementations for…
unclear · top 15,000 on PyPI
rocksdictRocksDict provides a Python interface to…
permissive · top 15,000 on PyPI
speedictSpeeDict is a Python key-value storage library…
permissive · top 15,000 on PyPI
historydictHistoryDict provides a persistent dictionary…
unclear · top 15,000 on PyPI
libsql-experimentalPython client library for Turso, a…
unclear · top 15,000 on PyPI
pymonetdbpymonetdb is a native Python client library for…
copyleft · top 15,000 on PyPI