Import Error: Cannot import EXCLUDED_METADATA_KEYS from langgraph.checkpoint.base #608

Closed
opened 2026-02-20 17:40:57 -05:00 by yindo · 3 comments
Owner

Originally created by @mingle-stripe on GitHub (May 2, 2025).

Originally assigned to: @sydney-runkle on GitHub.

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

requirements.txt

langgraph==0.4.1
langgraph-checkpoint==2.0.10
langgraph-prebuilt==0.1.8
langgraph-sdk==0.1.51

test.py

from langgraph.prebuilt.chat_agent_executor import create_react_agent

print("test")

Commands:

$ pip install -r requirements.txt
$ python test.py

Error Message and Stack Trace (if applicable)

Traceback (most recent call last):
  File "/Users/mingle/test/test.py", line 1, in <module>
    from langgraph.prebuilt.chat_agent_executor import create_react_agent
  File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/prebuilt/__init__.py", line 3, in <module>
    from langgraph.prebuilt.chat_agent_executor import create_react_agent
  File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/prebuilt/chat_agent_executor.py", line 39, in <module>
    from langgraph.graph import END, StateGraph
  File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/graph/__init__.py", line 1, in <module>
    from langgraph.graph.graph import END, START, Graph
  File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/graph/graph.py", line 27, in <module>
    from langgraph.graph.branch import Branch
  File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/graph/branch.py", line 30, in <module>
    from langgraph.pregel.write import PASSTHROUGH, ChannelWrite, ChannelWriteEntry
  File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 92, in <module>
    from langgraph.pregel.loop import AsyncPregelLoop, StreamProtocol, SyncPregelLoop
  File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/pregel/loop.py", line 31, in <module>
    from langgraph.checkpoint.base import (
ImportError: cannot import name 'EXCLUDED_METADATA_KEYS' from 'langgraph.checkpoint.base' (/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/checkpoint/base/__init__.py)

Description

When trying to import from the langgraph package, I encountered an import error.

The EXCLUDED_METADATA_KEYS constant is being imported from langgraph.checkpoint.base but it's not available in the minimum version of langgraph-checkpoint that is required.

  1. langgraph 0.3.24+ imports EXCLUDED_METADATA_KEYS from langgraph-checkpoint (introduced in this commit)
  2. However, EXCLUDED_METADATA_KEYS was not added to langgraph-checkpoint until version 2.0.15 (in this commit)
  3. The dependency specification in langgraph's pyproject.toml only requires langgraph-checkpoint>=2.0.10, which is too low:
langgraph-checkpoint = "^2.0.10"

System Info

System Information
------------------
> OS:  Darwin
> OS Version:  Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6000
> Python Version:  3.11.6 (main, Mar 19 2024, 14:54:25) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Package Information
-------------------
> langchain_core: 0.3.58
> langsmith: 0.3.41
> langgraph_sdk: 0.1.51

Optional packages not installed
-------------------------------
> langserve

Other Dependencies
------------------
> httpx: 0.28.1
> jsonpatch<2.0,>=1.33: Installed. No version info available.
> langsmith-pyo3: Installed. No version info available.
> langsmith<0.4,>=0.1.125: Installed. No version info available.
> openai-agents: Installed. No version info available.
> opentelemetry-api: Installed. No version info available.
> opentelemetry-exporter-otlp-proto-http: Installed. No version info available.
> opentelemetry-sdk: Installed. No version info available.
> orjson: 3.10.18
> packaging: 24.2
> packaging<25,>=23.2: Installed. No version info available.
> pydantic: 2.11.4
> pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
> pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
> pytest: Installed. No version info available.
> PyYAML>=5.3: Installed. No version info available.
> requests: 2.32.3
> requests-toolbelt: 1.0.0
> rich: Installed. No version info available.
> tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
> typing-extensions>=4.7: Installed. No version info available.
> zstandard: 0.23.0
Originally created by @mingle-stripe on GitHub (May 2, 2025). Originally assigned to: @sydney-runkle on GitHub. ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use GitHub Discussions. - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Example Code requirements.txt ```python langgraph==0.4.1 langgraph-checkpoint==2.0.10 langgraph-prebuilt==0.1.8 langgraph-sdk==0.1.51 ``` test.py ```python from langgraph.prebuilt.chat_agent_executor import create_react_agent print("test") ``` Commands: ```shell $ pip install -r requirements.txt $ python test.py ``` ### Error Message and Stack Trace (if applicable) ```shell Traceback (most recent call last): File "/Users/mingle/test/test.py", line 1, in <module> from langgraph.prebuilt.chat_agent_executor import create_react_agent File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/prebuilt/__init__.py", line 3, in <module> from langgraph.prebuilt.chat_agent_executor import create_react_agent File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/prebuilt/chat_agent_executor.py", line 39, in <module> from langgraph.graph import END, StateGraph File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/graph/__init__.py", line 1, in <module> from langgraph.graph.graph import END, START, Graph File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/graph/graph.py", line 27, in <module> from langgraph.graph.branch import Branch File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/graph/branch.py", line 30, in <module> from langgraph.pregel.write import PASSTHROUGH, ChannelWrite, ChannelWriteEntry File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 92, in <module> from langgraph.pregel.loop import AsyncPregelLoop, StreamProtocol, SyncPregelLoop File "/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/pregel/loop.py", line 31, in <module> from langgraph.checkpoint.base import ( ImportError: cannot import name 'EXCLUDED_METADATA_KEYS' from 'langgraph.checkpoint.base' (/Users/mingle/.pyenv/versions/3.11.6/lib/python3.11/site-packages/langgraph/checkpoint/base/__init__.py) ``` ### Description When trying to import from the langgraph package, I encountered an import error. The `EXCLUDED_METADATA_KEYS` constant is being imported from `langgraph.checkpoint.base` but it's not available in the minimum version of langgraph-checkpoint that is required. 1. langgraph 0.3.24+ imports `EXCLUDED_METADATA_KEYS` from langgraph-checkpoint (introduced in [this commit](https://github.com/langchain-ai/langgraph/commit/4dda404da37ec889e428699a0148e97f46f381e2)) 2. However, `EXCLUDED_METADATA_KEYS` was not added to langgraph-checkpoint until version 2.0.15 (in [this commit](https://github.com/langchain-ai/langgraph/commit/7f4822931ebf67e907bf93ba5939e833ac7f3b54)) 3. The dependency specification in langgraph's pyproject.toml only requires langgraph-checkpoint>=2.0.10, which is too low: ``` langgraph-checkpoint = "^2.0.10" ``` ### System Info ``` System Information ------------------ > OS: Darwin > OS Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6000 > Python Version: 3.11.6 (main, Mar 19 2024, 14:54:25) [Clang 15.0.0 (clang-1500.1.0.2.5)] Package Information ------------------- > langchain_core: 0.3.58 > langsmith: 0.3.41 > langgraph_sdk: 0.1.51 Optional packages not installed ------------------------------- > langserve Other Dependencies ------------------ > httpx: 0.28.1 > jsonpatch<2.0,>=1.33: Installed. No version info available. > langsmith-pyo3: Installed. No version info available. > langsmith<0.4,>=0.1.125: Installed. No version info available. > openai-agents: Installed. No version info available. > opentelemetry-api: Installed. No version info available. > opentelemetry-exporter-otlp-proto-http: Installed. No version info available. > opentelemetry-sdk: Installed. No version info available. > orjson: 3.10.18 > packaging: 24.2 > packaging<25,>=23.2: Installed. No version info available. > pydantic: 2.11.4 > pydantic<3.0.0,>=2.5.2;: Installed. No version info available. > pydantic<3.0.0,>=2.7.4;: Installed. No version info available. > pytest: Installed. No version info available. > PyYAML>=5.3: Installed. No version info available. > requests: 2.32.3 > requests-toolbelt: 1.0.0 > rich: Installed. No version info available. > tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available. > typing-extensions>=4.7: Installed. No version info available. > zstandard: 0.23.0 ```
yindo closed this issue 2026-02-20 17:40:57 -05:00
Author
Owner

@mingle-stripe commented on GitHub (May 2, 2025):

Similar issue reported a few weeks back: https://github.com/langchain-ai/langgraph/issues/4180

@mingle-stripe commented on GitHub (May 2, 2025): Similar issue reported a few weeks back: https://github.com/langchain-ai/langgraph/issues/4180
Author
Owner

@hinthornw commented on GitHub (May 2, 2025):

cc @sydney-runkle let's add a CI run for the minbound of langgraph-checkpoint (and langchain-core so long as we depend on it) to prevent future occurences

@hinthornw commented on GitHub (May 2, 2025): cc @sydney-runkle let's add a CI run for the minbound of langgraph-checkpoint (and langchain-core so long as we depend on it) to prevent future occurences
Author
Owner

@sydney-runkle commented on GitHub (Jun 11, 2025):

Going to close this particular issue as resolved, I've opened a new issue to track the testing against min versions specifically.

@sydney-runkle commented on GitHub (Jun 11, 2025): Going to close this particular issue as resolved, I've opened a new issue to track the testing against min versions specifically.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#608