pgvector
pgvector support for Python
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no dependencies, installs cleanly, carries no known vulnerabilities, and is MIT-licensed. Install it if you need vector search in PostgreSQL from Python—it's the standard bridge between pgvector and popular ORMs. Prerequisite: PostgreSQL with pgvector extension already set up.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires PostgreSQL with pgvector extension installed and a supported database driver (Django, SQLAlchemy, Psycopg, asyncpg, etc.)
- Low friction installation with no runtime dependencies.
- Active maintenance—last release 39 days ago with 1513 repository stars.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects.
last release 2026-07-06 (39 days) · last repo commit 2026-07-06 · 1,513 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 35,593,280 downloads/mo, #743 on PyPI
Alternatives
Verify before relying
pip install pgvector
from pgvector.django import VectorField
class Item(models.Model):
embedding = VectorField(dimensions=3)
from pgvector.django import L2Distance
Item.objects.order_by(L2Distance('embedding', [3, 1, 2]))[:5]- Whether pgvector extension installation on the PostgreSQL server is automatic or requires manual setup
- Performance characteristics for large-scale vector indexes (HNSW vs IVFFlat trade-offs)
- Compatibility matrix details for each supported ORM/driver combination
What it is and what it does
pgvector-python is a Python adapter that bridges vector search capabilities from the PostgreSQL pgvector extension into popular Python ORMs and database drivers. It allows you to store embeddings directly in PostgreSQL and query them using similarity metrics like L2 distance, cosine distance, and inner product, without leaving your database.
The package supports Django, SQLAlchemy, SQLModel, Psycopg 3, Psycopg 2, asyncpg, pg8000, and Peewee, providing native field types (VectorField, VECTOR, HALFVEC, BIT, SPARSEVEC) and query operators for nearest-neighbor retrieval, distance filtering, and approximate indexing via HNSW or IVFFlat algorithms. It's designed for applications that combine embeddings from LLMs, sentence transformers, or other ML models with traditional relational data.
Use it for
- Retrieval-augmented generation (RAG) pipelines storing document embeddings for semantic search
- Recommendation systems using embedding similarity to find related items or users
- Hybrid search combining vector similarity with keyword and metadata filters in a single query
- Image or visual search by storing embeddings from vision models and finding perceptually similar images
- Topic modeling or document clustering by storing and querying sentence/document embeddings
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no dependencies, installs cleanly, carries no known vulnerabilities, and is MIT-licensed. Install it if you need vector search in PostgreSQL from Python—it's the standard bridge between pgvector and popular ORMs. Prerequisite: PostgreSQL with pgvector extension already set up.
Install
pgvector on PyPI
Before you install
Low friction installation with no runtime dependencies. Active maintenance—last release 39 days ago with 1513 repository stars.
Requires PostgreSQL with pgvector extension installed and a supported database driver (Django, SQLAlchemy, Psycopg, asyncpg, etc.)
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects.
Quickstart
pip install pgvector
from pgvector.django import VectorField
class Item(models.Model):
embedding = VectorField(dimensions=3)
from pgvector.django import L2Distance
Item.objects.order_by(L2Distance('embedding', [3, 1, 2]))[:5]
Verify before relying
- Whether pgvector extension installation on the PostgreSQL server is automatic or requires manual setup
- Performance characteristics for large-scale vector indexes (HNSW vs IVFFlat trade-offs)
- Compatibility matrix details for each supported ORM/driver combination
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 39 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 35,593,280 / month, #743 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: pgvector-0.5.0-py3-none-any.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 › “pgvector django sqlalchemy”
- pgvectorAdds vector storage and similarity search support to PostgreSQL…
- py-pglitepy-pglite provides a zero-config PostgreSQL testing environment for…
- llama-index-vector-stores-postgresIntegrates PostgreSQL with pgvector extension as a vector store…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also pgvecto-rs · pyobvector · sqlite-vec · vecs · pgserver · llama-index-vector-stores-postgres · nano-vectordb · pg0-embedded · apache-airflow-providers-pgvector · voyager