Skip to content

fix: relax pgvector upper bound to <0.5#308

Open
paulflew wants to merge 1 commit into
langchain-ai:mainfrom
paulflew:fix/relax-pgvector-upper-bound
Open

fix: relax pgvector upper bound to <0.5#308
paulflew wants to merge 1 commit into
langchain-ai:mainfrom
paulflew:fix/relax-pgvector-upper-bound

Conversation

@paulflew

@paulflew paulflew commented Jun 4, 2026

Copy link
Copy Markdown

Problem

The pgvector dependency is pinned to >=0.2.5,<0.4. This upper bound prevents installing langchain-postgres alongside packages that require pgvector>=0.4.2 (e.g. lightrag-hku), causing unresolvable dependency conflicts.

Fixes #307.

Change

Relax the upper bound to >=0.2.5,<0.5, allowing the pgvector 0.4.x series while staying conservative (does not open up to an untested 0.5+).

Why this is safe

The only pgvector API surface used by this package is pgvector.sqlalchemy.Vector (langchain_postgres/vectorstores.py), which is unchanged across the 0.2.x–0.4.x line.

Verification

  • uv lock resolves cleanly to pgvector==0.4.2 under the new constraint.
  • uv sync --group test installs against 0.4.2, and from pgvector.sqlalchemy import Vector, import langchain_postgres, and from langchain_postgres import PGVector, PGVectorStore all import successfully.
  • uv.lock is regenerated and committed to stay in sync.

The pgvector constraint ">=0.2.5,<0.4" prevents installing
langchain-postgres alongside packages that require pgvector >=0.4.2
(e.g. lightrag-hku). The only pgvector API used is
`pgvector.sqlalchemy.Vector`, which is unchanged across 0.2.x-0.4.x,
so the upper bound can safely be relaxed to allow the 0.4 series.

Fixes langchain-ai#307

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@paulflew

paulflew commented Jun 4, 2026

Copy link
Copy Markdown
Author

Verified locally against the version this change unblocks:

  • uv lock resolves cleanly to pgvector==0.4.2 under the new >=0.2.5,<0.5 constraint.
  • Full test suite run against a live pgvector/pgvector:pg16 Postgres with pgvector==0.4.2 installed: 749 passed, 25 skipped, 0 failed (v1 + v2, sync + async, including the langchain_tests standard vectorstore conformance suite).

The only pgvector API used is pgvector.sqlalchemy.Vector, which is unchanged across the 0.2.x–0.4.x line, so the bump is safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version Constraint Issue: langchain-postgres 0.0.17 + pgvector >=0.4.2

1 participant