PostgreSQL server binaries as a pip-installable wheel, with a small Python layer to init, start and stop it
Maintained. Last release 3 months ago, commits in 1 of the last 26 weeks. Weaker on commit activity and contributor spread.
pip install embedded-postgresREADME as published on PyPI with version 18.6.3.
embedded-postgres
PostgreSQL server binaries as a pip-installable wheel, plus a small Python
layer that runs initdb, starts and stops the server, and hands you a
connection URI. No system PostgreSQL, no root, no Docker.
import embedded_postgres
with embedded_postgres.get_server("/path/to/pgdata") as pg:
uri = pg.get_uri() # postgresql://postgres:@localhost:PORT/postgres
pg.psql("create extension vector")
Status
Early. This project started on 2026-09-07 as a fork of pgserver, which had stopped at PostgreSQL 16.2 in mid-2024. The goals that justify a separate project:
- current PostgreSQL (18.6 today), with minor releases picked up as they ship;
- Linux aarch64 and armv7l wheels next to x86_64, macOS and Windows;
- one wheel per platform (
py3-none-<platform>) instead of one per Python version; - contrib modules such as
pg_stat_statementsshipped alongsidepgvector.
Current state (2026-09-07): PostgreSQL 18.6 + pgvector 0.8.6 build and pass
the test suite on six targets — manylinux_2_28 x86_64 and aarch64,
manylinux_2_31 armv7l (32-bit Raspberry Pi OS bullseye or newer; runs the
dependency-free smoke test instead of the full suite), macosx_11_0 arm64 and
x86_64, win_amd64 — 11–17 MB per wheel. Releases go to GitHub Releases and
PyPI: pip install embedded-postgres.
Windows and Administrator accounts
PostgreSQL's tools refuse to run with Administrator rights: initdb,
pg_ctl and postgres re-launch themselves with a restricted token in which
the Administrators group is deny-only. Any directory that is reachable only
through that group is then invisible to them — including the binaries
themselves. Since CPython 3.12.4, tempfile.mkdtemp() on Windows creates
exactly such directories (SYSTEM, Administrators and the owner; for an
administrator the owner is Administrators). Symptom:
invalid binary "...\embedded_postgres\pginstallin\initdb.exe": Permission denied
initdb: error: program "postgres" is needed by initdb but was not found in the same directory as "initdb"