[PR #4752] [docs] Revise pip-install packages for PostgresSaver in "how-to/Persistence" notebook #4047

Closed
opened 2026-02-20 17:49:34 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/4752

State: closed
Merged: Yes


The suggested change makes sure the binary extra is installed with psycopg, a necessary requirement -- according to my experience -- to avoid that the following import line:

>>> from langgraph.checkpoint.postgres import PostgresSaver

fails with this no pq wrapper available error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/stefano/.virtualenvs/TMP-lg-3.12/lib/python3.12/site-packages/langgraph/checkpoint/postgres/__init__.py", line 7, in <module>
    from psycopg import Capabilities, Connection, Cursor, Pipeline
  File "/home/stefano/.virtualenvs/TMP-lg-3.12/lib/python3.12/site-packages/psycopg/__init__.py", line 9, in <module>
    from . import pq  # noqa: F401 import early to stabilize side effects
    ^^^^^^^^^^^^^^^^
  File "/home/stefano/.virtualenvs/TMP-lg-3.12/lib/python3.12/site-packages/psycopg/pq/__init__.py", line 116, in <module>
    import_from_libpq()
  File "/home/stefano/.virtualenvs/TMP-lg-3.12/lib/python3.12/site-packages/psycopg/pq/__init__.py", line 108, in import_from_libpq
    raise ImportError(
ImportError: no pq wrapper available.
Attempts made:
- couldn't import psycopg 'c' implementation: No module named 'psycopg_c'
- couldn't import psycopg 'binary' implementation: No module named 'psycopg_binary'
- couldn't import psycopg 'python' implementation: libpq library not found

Note. I tested this claim on a fresh Python3.12 virtual environment and (langchain==0.3.25, langgraph==0.4.5).

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/4752 **State:** closed **Merged:** Yes --- The suggested change makes sure the `binary` extra is installed with psycopg, a necessary requirement -- according to my experience -- to avoid that the following import line: ``` >>> from langgraph.checkpoint.postgres import PostgresSaver ``` fails with this `no pq wrapper available` error: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/stefano/.virtualenvs/TMP-lg-3.12/lib/python3.12/site-packages/langgraph/checkpoint/postgres/__init__.py", line 7, in <module> from psycopg import Capabilities, Connection, Cursor, Pipeline File "/home/stefano/.virtualenvs/TMP-lg-3.12/lib/python3.12/site-packages/psycopg/__init__.py", line 9, in <module> from . import pq # noqa: F401 import early to stabilize side effects ^^^^^^^^^^^^^^^^ File "/home/stefano/.virtualenvs/TMP-lg-3.12/lib/python3.12/site-packages/psycopg/pq/__init__.py", line 116, in <module> import_from_libpq() File "/home/stefano/.virtualenvs/TMP-lg-3.12/lib/python3.12/site-packages/psycopg/pq/__init__.py", line 108, in import_from_libpq raise ImportError( ImportError: no pq wrapper available. Attempts made: - couldn't import psycopg 'c' implementation: No module named 'psycopg_c' - couldn't import psycopg 'binary' implementation: No module named 'psycopg_binary' - couldn't import psycopg 'python' implementation: libpq library not found ``` _Note_. I tested this claim on a fresh Python3.12 virtual environment and (`langchain==0.3.25`, `langgraph==0.4.5`).
yindo added the pull-request label 2026-02-20 17:49:34 -05:00
yindo closed this issue 2026-02-20 17:49:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4047