langgraph icon indicating copy to clipboard operation
langgraph copied to clipboard

LangGraph library not compatible with checkpointer base

Open SellCXHarsha opened this issue 1 year ago • 10 comments

Checked other resources

  • [X] I added a very descriptive title to this issue.
  • [X] I searched the LangGraph/LangChain documentation with the integrated search.
  • [X] I used the GitHub search to find a similar question and didn't find it.
  • [X] I am sure that this is a bug in LangGraph/LangChain rather than my code.
  • [X] I am sure this is better as an issue rather than a GitHub discussion, since this is a LangGraph bug and not a design question.

Example Code

async for event in graph.astream(initial_state, debug=True):
        if "__end__" not in event:
            logging.info(f"Event received: {json.dumps(event, default=str)}")
            yield event

Error Message and Stack Trace (if applicable)

File "/usr/local/lib/python3.10/dist-packages/langgraph/graph/__init__.py", line 1, in <module>
    from langgraph.graph.graph import END, Graph
  File "/usr/local/lib/python3.10/dist-packages/langgraph/graph/graph.py", line 26, in <module>
    from langgraph.channels.ephemeral_value import EphemeralValue
  File "/usr/local/lib/python3.10/dist-packages/langgraph/channels/__init__.py", line 1, in <module>
    from langgraph.channels.binop import BinaryOperatorAggregate
  File "/usr/local/lib/python3.10/dist-packages/langgraph/channels/binop.py", line 6, in <module>
    from langgraph.channels.base import BaseChannel, EmptyChannelError, Value
  File "/usr/local/lib/python3.10/dist-packages/langgraph/channels/base.py", line 17, in <module>
    from langgraph.checkpoint.base import Checkpoint
  File "/usr/local/lib/python3.10/dist-packages/langgraph/checkpoint/__init__.py", line 1, in <module>
    from langgraph.checkpoint.base import (
ImportError: cannot import name 'CheckpointAt' from 'langgraph.checkpoint.base' (/usr/local/lib/python3.10/dist-packages/langgraph/checkpoint/base/__init__.py)

Description

Im not sure hyw this is not working

System Info

langgraph==0.2.0 langgraph-checkpoint==1.0.2 langgraph-checkpoint-postgres==1.0.3 langgraph-checkpoint-sqlite==1.0.0

SellCXHarsha avatar Aug 09 '24 21:08 SellCXHarsha

you need to update to langgraph 0.2.3

vbarda avatar Aug 09 '24 21:08 vbarda

let me know if you're still facing the issue after updating!

vbarda avatar Aug 09 '24 21:08 vbarda

Hi, I am still facing the same issue.. it did not change the error unfortunately

SellCXHarsha avatar Aug 09 '24 22:08 SellCXHarsha

@SellCXHarsha could you please provide full code snippet with minimal reproducible example for the error?

vbarda avatar Aug 09 '24 22:08 vbarda

from langgraph.graph import StateGraph, END it fails on this line when i upgrade to langgraph 0.2.3

SellCXHarsha avatar Aug 09 '24 22:08 SellCXHarsha

This is working fine for me - can you send me the entire error trace?

isahers1 avatar Aug 09 '24 23:08 isahers1

harsha@harsha-Sword-15-A12UE:~/SellCX/Sandbox/api$ /bin/python3 /home/harsha/SellCX/Sandbox/api/Aysnc_Multi_Agent/ProCotAgent/proCoT_agent.py Traceback (most recent call last): File "/home/harsha/SellCX/Sandbox/api/Aysnc_Multi_Agent/ProCotAgent/proCoT_agent.py", line 7, in from langgraph.graph import StateGraph, END, START File "/usr/local/lib/python3.10/dist-packages/langgraph/graph/init.py", line 1, in from langgraph.graph.graph import END, Graph File "/usr/local/lib/python3.10/dist-packages/langgraph/graph/graph.py", line 26, in from langgraph.channels.ephemeral_value import EphemeralValue File "/usr/local/lib/python3.10/dist-packages/langgraph/channels/init.py", line 1, in from langgraph.channels.binop import BinaryOperatorAggregate File "/usr/local/lib/python3.10/dist-packages/langgraph/channels/binop.py", line 6, in from langgraph.channels.base import BaseChannel, EmptyChannelError, Value File "/usr/local/lib/python3.10/dist-packages/langgraph/channels/base.py", line 17, in from langgraph.checkpoint.base import Checkpoint File "/usr/local/lib/python3.10/dist-packages/langgraph/checkpoint/init.py", line 1, in from langgraph.checkpoint.base import ( ImportError: cannot import name 'CheckpointAt' from 'langgraph.checkpoint.base' (/usr/local/lib/python3.10/dist-packages/langgraph/checkpoint/base/init.py)

and the versioning: langgraph==0.2.3 langgraph-checkpoint==1.0.2 langgraph-checkpoint-postgres==1.0.3 langgraph-checkpoint-sqlite==1.0.0

SellCXHarsha avatar Aug 09 '24 23:08 SellCXHarsha

Thank you, looking into it now

isahers1 avatar Aug 09 '24 23:08 isahers1

Hmm I don't see a CheckpointAt import anywhere in LangGraph.checkpoint.base, could you maybe try uninstalling and then reinstalling the packages and trying again? Lmk if that doesn't work.

isahers1 avatar Aug 09 '24 23:08 isahers1

@SellCXHarsha please let us know if re-installing the package from scratch fixes the issue!

vbarda avatar Aug 12 '24 13:08 vbarda

Closing due to inactivity

nfcampos avatar Aug 24 '24 01:08 nfcampos

FWIW, CheckpointAt was used in opengpts repo here; also available in docs from a simple google search!

However, it was probably removed, so older code breaks if langgraph is upgraded. Not sure what the equivalent migration code looks like...

nitin-lamba-ck avatar Oct 03 '24 02:10 nitin-lamba-ck

is thee a solution for this?

Eliandrotg avatar Nov 19 '24 12:11 Eliandrotg

We landed-up abandoning the older checkpoint code in openGPTs, and upgraded to using AsyncPostgresSaver. It came with it's own challenges - needing a patch in langgraph to fix type-checking failures in ConfigurableFieldSpec. Debugging this is painful due to so many moving parts and fast-changing interfaces...😢

Following is our working dependency environment:

langchain = "^0.2.16"
langgraph = "^0.2.39" # 0.1.19
langgraph-checkpoint = "^2.0.2"
langgraph-checkpoint-postgres = "^2.0.2"
pydantic = "<2.0"
langchain-core = "^0.2.41"

nitin-lamba-ck avatar Nov 20 '24 00:11 nitin-lamba-ck

@nitin-lamba-ck - we had a custom RedisCheckpoint (class RedisCheckpoint(BaseCheckpointSaver): and using like such CHECKPOINTER = RedisCheckpoint( at = CheckpointAt.END_OF_STEP) but now because CheckpointAt enum doesnt exist my chat bot breaks . did you change the native langgraph library ? thank you for the pointers.

Eliandrotg avatar Nov 20 '24 09:11 Eliandrotg

Yes, I did change the native langgraph 2.0.x library to get past the error (lot of debugging time to isolate the problem).

From the latest checkpoint packages, I don't see officially/ community supported library for Redis; only sqlite, postgres and duckdb are available. So, unfortunately, you may have to re-implement that custom RedisCheckpoint using the latest 2.0.x version.

FWIW, here's a MongoDB pattern (checkpoint.py) without using those older enums.

Good luck!

nitin-lamba-ck avatar Nov 20 '24 18:11 nitin-lamba-ck

thank you so much - good pointers and have something to base my notions on now.

Eliandrotg avatar Nov 21 '24 16:11 Eliandrotg

you need to update to langgraph 0.2.3

facing the same issue.

library versions: langchain 0.2.17 langchain-anthropic 0.1.13 langchain-core 0.2.43 langchain-openai 0.1.7 langchain-text-splitters 0.2.4 langgraph 0.2.69 langgraph-checkpoint 2.0.10 langgraph-sdk 0.1.51 langsmith 0.1.147

yadgire7 avatar Feb 10 '25 21:02 yadgire7

FWIW, another project (OpenGPT) had a recent commit last week to upgrade, and this checkpoint code in 2cf3bf7 is a good reference to update your old code to the new version.

Good luck!

nitin-lamba-ck avatar Feb 11 '25 18:02 nitin-lamba-ck