Registry / database / pysqlite3-binary

pysqlite3-binary

JSON →
library0.5.4.post2pypypi✓ verified 24d ago

This library takes the SQLite module from Python 3 and packages it as a separately-installable module. The binary package is statically compiled, which makes it easy to embed the library and ensures a recent SQLite version with many features enabled, such as FTS (Full-Text Search), user-defined window functions, and native backup API. It is currently at version 0.5.4.post2 and is actively maintained.

pip install pysqlite3-binary
INSTALL
IMPORT
SIG · PYSQLITE3-BINARY
P
pysqlite3-binary
databasepythonv0.5.4.post2
Install
1.7s avg
Import
10ms
Disk
30MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.4.post2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.002s · 32MB
30MB installed
● package 30MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pysqlite3
import pysqlite3
import sqlite3 (after installing pysqlite3-binary, but without explicit sys.modules swap)
Importing 'sqlite3' will typically load the standard library's version unless `sys.modules['sqlite3']` is explicitly overridden.

Demonstrates connecting to an in-memory SQLite database, creating a table, inserting data, querying, and closing the connection using the pysqlite3 module.

import pysqlite3 conn = pysqlite3.connect(':memory:') cursor = conn.cursor() cursor.execute('CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)') cursor.execute('INSERT INTO users (name, email) VALUES (?, ?)', ('Alice', 'alice@example.com')) cursor.execute('INSERT INTO users (name, email) VALUES (?, ?)', ('Bob', 'bob@example.com')) conn.commit() for row in cursor.execute('SELECT * FROM users'): print(row) conn.close()
Debug
Known issues
gotchaTo replace the standard library's `sqlite3` module with `pysqlite3` for an entire application (e.g., in a Django project or for other libraries expecting `sqlite3`), you must explicitly swap the modules in `sys.modules` early in your application's startup. Otherwise, `import sqlite3` will still load the built-in version.
fix
Add these lines at the very beginning of your main application entry point:
`import pysqlite3
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')`
affects: All versions where standard library `sqlite3` exists
gotchaOn newer Python versions (e.g., Python 3.12+), the built-in `sqlite3` module might already include a sufficiently recent SQLite version. In such cases, installing `pysqlite3-binary` might be unnecessary and could potentially lead to confusion if the `sys.modules` swap is not used consistently.
fix
Check your Python version's built-in `sqlite3` version (`sqlite3.sqlite_version`) before deciding to use `pysqlite3-binary`.
affects: Python 3.12+
breakingEarly versions (prior to 0.5.1 or 0.6.0, depending on the source) of `pysqlite3-binary` might not have been fully self-contained or provided pre-built wheels for all platforms, requiring manual compilation or system dependencies.
fix
Upgrade to the latest `pysqlite3-binary` version (0.5.1+ or 0.6.0+) to ensure a fully self-contained binary distribution with wheels for common platforms.
affects: < 0.5.1 or < 0.6.0
gotchaIf you intend to link against a system SQLite library or a specific custom SQLite build instead of using the self-contained binary, you must install the `pysqlite3` source distribution (not `pysqlite3-binary`) and follow specific build steps (e.g., `python setup.py build_static build` or `pip install pysqlite3 --no-binary pysqlite3`).
fix
For source-based installations, install `pysqlite3` and consult its README for specific build instructions, rather than installing `pysqlite3-binary`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pysqlite3'
The 'pysqlite3-binary' package, which provides the 'pysqlite3' module, has not been installed in the current Python environment.
fix
pip install pysqlite3-binary
AttributeError: module 'pysqlite3' has no attribute 'connect'
The DB-API 2.0 interface, including the 'connect' function, resides within the 'pysqlite3.dbapi2' submodule, not directly exposed by the top-level 'pysqlite3' module.
fix
import pysqlite3.dbapi2 as sqlite3
sqlite3.OperationalError: no such module: fts5
Despite 'pysqlite3-binary' being installed, the code is likely importing the standard library's 'sqlite3' module, which often lacks advanced features like FTS5.
fix
Replace `import sqlite3` with `import pysqlite3.dbapi2 as sqlite3` at the top of your file to ensure the feature-rich 'pysqlite3-binary' version is used.
Upgrade
Version history
0.5.4.post2latest on PyPI · released Dec 3, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
1
Resources
pysqlite3-binary — pip install pysqlite3-binary · libregistry