TypeError: Cannot create a consistent method resolution order (MRO) for bases ABC, Generic #842

Closed
opened 2026-02-20 17:42:01 -05:00 by yindo · 9 comments
Owner

Originally created by @risetoday on GitHub (Jul 25, 2025).

Originally assigned to: @sydney-runkle on GitHub.

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • 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

from langgraph.graph import StateGraph, START, END

Error Message and Stack Trace (if applicable)

File "D:\Program Files\Python313\Lib\site-packages\langgraph\pregel\protocol.py", line 16, in <module>
    class PregelProtocol(Runnable[InputT, Any], Generic[StateT, InputT, OutputT], ABC):
    ...<123 lines>...
        ) -> dict[str, Any] | Any: ...
  File "<frozen abc>", line 106, in __new__
TypeError: Cannot create a consistent method resolution order (MRO) for bases ABC, Generic

Description

langGraph还不适配python3.13吗?

System Info

System Information

OS: Windows
OS Version: 10.0.26100
Python Version: 3.13.0 (tags/v3.13.0:60403a5, Oct 7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)]

Package Information

langchain_core: 0.3.68
langsmith: 0.4.4
langgraph_sdk: 0.1.72

Optional packages not installed

langserve

Other Dependencies

httpx: 0.28.1
httpx>=0.25.2: Installed. No version info available.
jsonpatch<2.0,>=1.33: Installed. No version info available.
langsmith-pyo3: Installed. No version info available.
langsmith>=0.3.45: 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
orjson>=3.10.1: Installed. No version info available.
packaging: 24.2
packaging<25,>=23.2: Installed. No version info available.
pydantic: 2.11.7
pydantic>=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 @risetoday on GitHub (Jul 25, 2025). Originally assigned to: @sydney-runkle on GitHub. ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/). - [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 ```python from langgraph.graph import StateGraph, START, END ``` ### Error Message and Stack Trace (if applicable) ```shell File "D:\Program Files\Python313\Lib\site-packages\langgraph\pregel\protocol.py", line 16, in <module> class PregelProtocol(Runnable[InputT, Any], Generic[StateT, InputT, OutputT], ABC): ...<123 lines>... ) -> dict[str, Any] | Any: ... File "<frozen abc>", line 106, in __new__ TypeError: Cannot create a consistent method resolution order (MRO) for bases ABC, Generic ``` ### Description langGraph还不适配python3.13吗? ### System Info System Information ------------------ > OS: Windows > OS Version: 10.0.26100 > Python Version: 3.13.0 (tags/v3.13.0:60403a5, Oct 7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] Package Information ------------------- > langchain_core: 0.3.68 > langsmith: 0.4.4 > langgraph_sdk: 0.1.72 Optional packages not installed ------------------------------- > langserve Other Dependencies ------------------ > httpx: 0.28.1 > httpx>=0.25.2: Installed. No version info available. > jsonpatch<2.0,>=1.33: Installed. No version info available. > langsmith-pyo3: Installed. No version info available. > langsmith>=0.3.45: 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 > orjson>=3.10.1: Installed. No version info available. > packaging: 24.2 > packaging<25,>=23.2: Installed. No version info available. > pydantic: 2.11.7 > pydantic>=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 added the bug label 2026-02-20 17:42:01 -05:00
yindo closed this issue 2026-02-20 17:42:01 -05:00
Author
Owner

@sydney-runkle commented on GitHub (Jul 25, 2025):

Should be fixed on latest langgraph, but we might yank versions where this cropped up as it's a commonly reported problem from users. Thanks for the report.

@sydney-runkle commented on GitHub (Jul 25, 2025): Should be fixed on latest langgraph, but we might yank versions where this cropped up as it's a commonly reported problem from users. Thanks for the report.
Author
Owner

@sydney-runkle commented on GitHub (Jul 25, 2025):

This is fixed in v0.5.3+, we've decided not to yank older versions. Will be releasing v0.6 on Monday where this is fixed as well.

@sydney-runkle commented on GitHub (Jul 25, 2025): This is fixed in v0.5.3+, we've decided not to yank older versions. Will be releasing v0.6 on Monday where this is fixed as well.
Author
Owner

@Yacklin commented on GitHub (Jul 27, 2025):

I encountered this bug today too. Thanks for reporting!!!

@Yacklin commented on GitHub (Jul 27, 2025): I encountered this bug today too. Thanks for reporting!!!
Author
Owner

@prateeknigam9 commented on GitHub (Jul 27, 2025):

I am having the same issue, on calling any langchain_core or langchain.tools

chunk of error -

`File c:\Users\nigam\miniconda3\envs\agenticAI\Lib\site-packages\langchain\tools\retriever.py:1
----> 1 from langchain_core.tools import (
2 create_retriever_tool,
3 render_text_description,
4 render_text_description_and_args,
5 )
7 all = [
8 "create_retriever_tool",
9 "render_text_description",
10 "render_text_description_and_args",
11 ]

File :1412, in handle_fromlist(module, fromlist, import, recursive)

File c:\Users\nigam\miniconda3\envs\agenticAI\Lib\site-packages\langchain_core\tools_init_.py:102, in getattr(attr_name)
...
138 mro = cls.mro

File :106, in new(mcls, name, bases, namespace, **kwargs)

TypeError: Cannot create a consistent method resolution order (MRO) for bases Generic, ABC`

@prateeknigam9 commented on GitHub (Jul 27, 2025): I am having the same issue, on calling any langchain_core or langchain.tools chunk of error - `File c:\Users\nigam\miniconda3\envs\agenticAI\Lib\site-packages\langchain\tools\retriever.py:1 ----> 1 from langchain_core.tools import ( 2 create_retriever_tool, 3 render_text_description, 4 render_text_description_and_args, 5 ) 7 __all__ = [ 8 "create_retriever_tool", 9 "render_text_description", 10 "render_text_description_and_args", 11 ] File <frozen importlib._bootstrap>:1412, in _handle_fromlist(module, fromlist, import_, recursive) File c:\Users\nigam\miniconda3\envs\agenticAI\Lib\site-packages\langchain_core\tools\__init__.py:102, in __getattr__(attr_name) ... 138 mro = cls.__mro__ File <frozen abc>:106, in __new__(mcls, name, bases, namespace, **kwargs) TypeError: Cannot create a consistent method resolution order (MRO) for bases Generic, ABC`
Author
Owner

@sydney-runkle commented on GitHub (Jul 27, 2025):

Which version of langgraph are you on @prateeknigam9? Should be fixed if you upgrade.

@sydney-runkle commented on GitHub (Jul 27, 2025): Which version of langgraph are you on @prateeknigam9? Should be fixed if you upgrade.
Author
Owner

@prateeknigam9 commented on GitHub (Jul 28, 2025):

@sydney-runkle , Its resolved, I changed my environment with new one, and reinstalled the library, and it worked. Thankyou
I think it was not updated for me individually. My venv was the issue somehow.

Thankyou

@prateeknigam9 commented on GitHub (Jul 28, 2025): @sydney-runkle , Its resolved, I changed my environment with new one, and reinstalled the library, and it worked. Thankyou I think it was not updated for me individually. My venv was the issue somehow. Thankyou
Author
Owner

@AbyssV commented on GitHub (Jul 28, 2025):

I encountered the same problem today. Haven't been solved yet. Im using uv with python3.13(also tried 3.11, both failed). Not sure if the newest version is compatible with uv

@AbyssV commented on GitHub (Jul 28, 2025): I encountered the same problem today. Haven't been solved yet. Im using uv with python3.13(also tried 3.11, both failed). Not sure if the newest version is compatible with uv
Author
Owner

@sydney-runkle commented on GitHub (Jul 28, 2025):

You can use uv pip install langgraph==0.5.4. This was due to a change in langchain-core in the base class order for Runnable, which Pregel inherits from.

@sydney-runkle commented on GitHub (Jul 28, 2025): You can use `uv pip install langgraph==0.5.4`. This was due to a change in `langchain-core` in the base class order for `Runnable`, which `Pregel` inherits from.
Author
Owner

@akystyle commented on GitHub (Aug 14, 2025):

This issue is still re-producible specifically with langchain_google_vertexai.

Here are my versions:

"langchain-anthropic>=0.3.10",
"langchain-community>=0.3.20",
"langchain-experimental>=0.3.4",
"langchain-openai>=0.3.9",
"langchain-google-vertexai>=2.0.28",
"langgraph==0.5.4",
"langgraph-checkpoint-sqlite>=2.0.6",
"langsmith>=0.3.18",
"lxml>=5.3.1",

Here's the error message:

File ~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_google_vertexai/chains.py:15
9 import google.cloud.aiplatform_v1beta1.types as gapic
10 from langchain_core.output_parsers import (
11 BaseGenerationOutputParser,
12 BaseOutputParser,
13 StrOutputParser,
14 )
---> 15 from langchain_core.prompts import BasePromptTemplate, ChatPromptTemplate
16 from langchain_core.runnables import Runnable
17 from pydantic import BaseModel

File :1412, in handle_fromlist(module, fromlist, import, recursive)

File ~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_core/prompts/__init__.py:119, in getattr(attr_name)
117 def getattr(attr_name: str) -> object:
118 module_name = _dynamic_imports.get(attr_name)
--> 119 result = import_attr(attr_name, module_name, spec.parent)
120 globals()[attr_name] = result
121 return result

File ~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_core/_import_utils.py:29, in import_attr(attr_name, module_name, package)
27 else:
28 try:
---> 29 module = import_module(f".{module_name}", package=package)
30 except ModuleNotFoundError as err:
31 msg = f"module '{package!r}.{module_name!r}' not found ({err})"

File ~/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/importlib/__init__.py:90, in import_module(name, package)
88 break
89 level += 1
---> 90 return _bootstrap._gcd_import(name[level:], package, level)

File ~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_core/prompts/base.py:45
39 from langchain_core.documents import Document
42 FormatOutputType = TypeVar("FormatOutputType")
---> 45 class BasePromptTemplate(
46 RunnableSerializable[dict, PromptValue], ABC, Generic[FormatOutputType]
47 ):
48 """Base class for all prompt templates, returning a prompt."""
50 input_variables: list[str]

File ~/Downloads/agents/.venv/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py:135, in ModelMetaclass.new(mcs, cls_name, bases, namespace, pydantic_generic_metadata, pydantic_reset_parent_namespace, create_model_module, **kwargs)
132 namespace['class_vars'] = class_vars
133 namespace['private_attributes'] = {**base_private_attributes, **private_attributes}
--> 135 cls = cast('type[BaseModel]', super().new(mcs, cls_name, bases, namespace, **kwargs))
136 BaseModel
= import_cached_base_model()
138 mro = cls.mro

File :106, in new(mcls, name, bases, namespace, **kwargs)

TypeError: Cannot create a consistent method resolution
order (MRO) for bases Generic, ABC

@akystyle commented on GitHub (Aug 14, 2025): This issue is still re-producible specifically with **langchain_google_vertexai**. # Here are my versions: "langchain-anthropic>=0.3.10", "langchain-community>=0.3.20", "langchain-experimental>=0.3.4", "langchain-openai>=0.3.9", "langchain-google-vertexai>=2.0.28", "langgraph==0.5.4", "langgraph-checkpoint-sqlite>=2.0.6", "langsmith>=0.3.18", "lxml>=5.3.1", # Here's the error message: File ~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_google_vertexai/chains.py:15 9 import google.cloud.aiplatform_v1beta1.types as gapic 10 from langchain_core.output_parsers import ( 11 BaseGenerationOutputParser, 12 BaseOutputParser, 13 StrOutputParser, 14 ) ---> [15](https://file+.vscode-resource.vscode-cdn.net/home/akygoel/Downloads/agents/4_langgraph/~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_google_vertexai/chains.py:15) from langchain_core.prompts import BasePromptTemplate, ChatPromptTemplate 16 from langchain_core.runnables import Runnable 17 from pydantic import BaseModel File <frozen importlib._bootstrap>:1412, in _handle_fromlist(module, fromlist, import_, recursive) File ~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_core/prompts/__init__.py:119, in __getattr__(attr_name) 117 def __getattr__(attr_name: str) -> object: 118 module_name = _dynamic_imports.get(attr_name) --> [119](https://file+.vscode-resource.vscode-cdn.net/home/akygoel/Downloads/agents/4_langgraph/~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_core/prompts/__init__.py:119) result = import_attr(attr_name, module_name, __spec__.parent) 120 globals()[attr_name] = result 121 return result File ~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_core/_import_utils.py:29, in import_attr(attr_name, module_name, package) 27 else: 28 try: ---> [29](https://file+.vscode-resource.vscode-cdn.net/home/akygoel/Downloads/agents/4_langgraph/~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_core/_import_utils.py:29) module = import_module(f".{module_name}", package=package) 30 except ModuleNotFoundError as err: 31 msg = f"module '{package!r}.{module_name!r}' not found ({err})" File ~/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/importlib/__init__.py:90, in import_module(name, package) 88 break 89 level += 1 ---> [90](https://file+.vscode-resource.vscode-cdn.net/home/akygoel/Downloads/agents/4_langgraph/~/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/importlib/__init__.py:90) return _bootstrap._gcd_import(name[level:], package, level) File ~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_core/prompts/base.py:45 39 from langchain_core.documents import Document 42 FormatOutputType = TypeVar("FormatOutputType") ---> [45](https://file+.vscode-resource.vscode-cdn.net/home/akygoel/Downloads/agents/4_langgraph/~/Downloads/agents/.venv/lib/python3.12/site-packages/langchain_core/prompts/base.py:45) class BasePromptTemplate( 46 RunnableSerializable[dict, PromptValue], ABC, Generic[FormatOutputType] 47 ): 48 """Base class for all prompt templates, returning a prompt.""" 50 input_variables: list[str] File ~/Downloads/agents/.venv/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py:135, in ModelMetaclass.__new__(mcs, cls_name, bases, namespace, __pydantic_generic_metadata__, __pydantic_reset_parent_namespace__, _create_model_module, **kwargs) 132 namespace['__class_vars__'] = class_vars 133 namespace['__private_attributes__'] = {**base_private_attributes, **private_attributes} --> [135](https://file+.vscode-resource.vscode-cdn.net/home/akygoel/Downloads/agents/4_langgraph/~/Downloads/agents/.venv/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py:135) cls = cast('type[BaseModel]', super().__new__(mcs, cls_name, bases, namespace, **kwargs)) 136 BaseModel_ = import_cached_base_model() 138 mro = cls.__mro__ File <frozen abc>:106, in __new__(mcls, name, bases, namespace, **kwargs) TypeError: Cannot create a consistent method resolution order (MRO) for bases Generic, ABC
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#842