psycopg2-binary
psycopg2 - Python-PostgreSQL Database Adapter
Decision gist · record as of 2026-08-14
Yes, for development and testing. psycopg2-binary is the most widely used PostgreSQL adapter for Python and is actively maintained. The binary distribution removes compiler dependencies, making it straightforward to install. For production deployments, consider the source-built psycopg2 package instead. No known security vulnerabilities and LGPL licensing is compatible with most projects.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a running PostgreSQL server accessible at the connection string provided; psycopg2-binary is a client library and does not include or start a database server.
- Medium install friction due to binary wheel distribution; pre-compiled wheels available for common platforms (macOS, Linux, Windows) across multiple architectures, avoiding the need for a C compiler and development libraries at install time.
- Actively maintained with recent releases.
License · maintenance · safety
LGPL with exceptions (copyleft) — Licensed under LGPL with exceptions (copyleft). Derivative works and modifications must be distributed under compatible terms, but linking to psycopg2-binary in a proprietary application is generally permitted under the exception clause.
last release 2026-04-20 (116 days) · last repo commit 2026-05-02 · 3,652 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 271,618,065 downloads/mo, #149 on PyPI
Alternatives
Verify before relying
pip install psycopg2-binary
import psycopg2
conn = psycopg2.connect("dbname=test user=postgres")
cur = conn.cursor()
cur.execute("SELECT * FROM table")
results = cur.fetchall()- Whether psycopg2-binary's pre-compiled binaries are suitable for production deployments or if source-built psycopg2 is recommended instead (description notes binary is practical for development/testing).
- Performance characteristics and any runtime overhead of the binary distribution compared to source-compiled builds.
What it is and what it does
psycopg2-binary is a PostgreSQL client library for Python that wraps libpq and implements the Python DB API 2.0 specification. It allows Python applications to open connections to PostgreSQL databases, execute queries, manage transactions, and handle result sets. The package is implemented primarily in C for efficiency and security, and supports both client-side and server-side cursors, asynchronous communication, COPY operations, and automatic type adaptation between Python and PostgreSQL data types.
The binary distribution (psycopg2-binary) ships with pre-compiled wheels for multiple platforms and architectures, eliminating the need for a C compiler or development libraries at install time. This makes it convenient for development and testing environments. However, the description notes that for production use, the source-built psycopg2 package is advised. The package is actively maintained and supports modern Python versions (3.9 through 3.14), though new feature development is focused on Psycopg 3.
Use it for
- Building web applications that need to query PostgreSQL databases for user data, content, or transactional operations.
- Creating data pipelines or ETL scripts that read from or write to PostgreSQL tables.
- Developing multi-threaded applications that require concurrent database access from multiple threads sharing the same connection.
- Prototyping or testing database-backed applications without setting up a production-grade database driver.
- Migrating legacy Python 2 applications to Python 3 while maintaining PostgreSQL connectivity.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, for development and testing.
psycopg2-binary is the most widely used PostgreSQL adapter for Python and is actively maintained. The binary distribution removes compiler dependencies, making it straightforward to install. For production deployments, consider the source-built psycopg2 package instead. No known security vulnerabilities and LGPL licensing is compatible with most projects.
Install
psycopg2-binary on PyPI
Before you install
Medium install friction due to binary wheel distribution; pre-compiled wheels available for common platforms (macOS, Linux, Windows) across multiple architectures, avoiding the need for a C compiler and development libraries at install time. Actively maintained with recent releases.
Requires a running PostgreSQL server accessible at the connection string provided; psycopg2-binary is a client library and does not include or start a database server.
License in practice
Licensed under LGPL with exceptions (copyleft). Derivative works and modifications must be distributed under compatible terms, but linking to psycopg2-binary in a proprietary application is generally permitted under the exception clause.
Quickstart
pip install psycopg2-binary
import psycopg2
conn = psycopg2.connect("dbname=test user=postgres")
cur = conn.cursor()
cur.execute("SELECT * FROM table")
results = cur.fetchall()
Verify before relying
- Whether psycopg2-binary's pre-compiled binaries are suitable for production deployments or if source-built psycopg2 is recommended instead (description notes binary is practical for development/testing).
- Performance characteristics and any runtime overhead of the binary distribution compared to source-compiled builds.
Package facts
| License | LGPL with exceptions copyleft |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 116 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 271,618,065 / month, #149 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)Operating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: CProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: SQLTopic :: DatabaseTopic :: Database :: Front-EndsTopic :: Software DevelopmentTopic :: Software Development :: Libraries :: Python Modules |
Evidence: psycopg2_binary-2.9.12-cp310-cp310-macosx_10_9_x86_64.whl; psycopg2_binary-2.9.12-cp310-cp310-macosx_11_0_arm64.whl; psycopg2_binary-2.9.12-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl; psycopg2_binary-2.9.12-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; psycopg2_binary-2.9.12-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; psycopg2_binary-2.9.12-cp310-cp310-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl; psycopg2_binary-2.9.12-cp310-cp310-musllinux_1_2_aarch64.whl; psycopg2_binary-2.9.12-cp310-cp310-musllinux_1_2_ppc64le.whl; psycopg2_binary-2.9.12-cp310-cp310-musllinux_1_2_riscv64.whl; psycopg2_binary-2.9.12-cp310-cp310-musllinux_1_2_x86_64.whl; psycopg2_binary-2.9.12-cp310-cp310-win_amd64.whl; psycopg2_binary-2.9.12-cp311-cp311-macosx_10_9_x86_64.whl; psycopg2_binary-2.9.12-cp311-cp311-macosx_11_0_arm64.whl; psycopg2_binary-2.9.12-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl; psycopg2_binary-2.9.12-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; psycopg2_binary-2.9.12-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; psycopg2_binary-2.9.12-cp311-cp311-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl; psycopg2_binary-2.9.12-cp311-cp311-musllinux_1_2_aarch64.whl; psycopg2_binary-2.9.12-cp311-cp311-musllinux_1_2_ppc64le.whl; psycopg2_binary-2.9.12-cp311-cp311-musllinux_1_2_riscv64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “python db api postgresql”
- psycopg2-binarypsycopg2-binary is a PostgreSQL database adapter for Python that…
- psycopg2PostgreSQL database adapter for Python that implements the DB API 2.0…
- django-db-connection-poolProvides connection pooling for Django database backends (MySQL,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also aws-psycopg2 · pgcopy · psycopg2 · PyGreSQL · pg8000 · psycopg · psycopg-binary · psycopg-c · psycogreen · psycopg-pool