geekan / MetaGPT

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
https://deepwisdom.ai/
MIT License
44.9k stars 5.34k forks source link

TypeError: issubclass() arg 1 must be a class #175

Closed gaoxunyang closed 3 weeks ago

gaoxunyang commented 1 year ago

env: mac intel

→ metagpt (main) $ python startup.py "Write a cli snake game" 2023-08-09 15:33:42.370 | INFO | metagpt.config:init:44 - Config loading done. Traceback (most recent call last): File "/Users/xunyanggao/projects/ai/metagpt/startup.py", line 7, in from metagpt.roles import Architect, Engineer, ProductManager, ProjectManager, QaEngineer File "/Users/xunyanggao/projects/ai/metagpt/metagpt/roles/init.py", line 9, in from metagpt.roles.role import Role File "/Users/xunyanggao/projects/ai/metagpt/metagpt/roles/role.py", line 19, in from metagpt.memory import Memory, LongTermMemory File "/Users/xunyanggao/projects/ai/metagpt/metagpt/memory/init.py", line 10, in from metagpt.memory.longterm_memory import LongTermMemory File "/Users/xunyanggao/projects/ai/metagpt/metagpt/memory/longterm_memory.py", line 10, in from metagpt.memory.memory_storage import MemoryStorage File "/Users/xunyanggao/projects/ai/metagpt/metagpt/memory/memory_storage.py", line 8, in from langchain.vectorstores.faiss import FAISS File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain-0.0.231-py3.9.egg/langchain/init.py", line 6, in from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain-0.0.231-py3.9.egg/langchain/agents/init.py", line 2, in from langchain.agents.agent import ( File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain-0.0.231-py3.9.egg/langchain/agents/agent.py", line 16, in from langchain.agents.tools import InvalidTool File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain-0.0.231-py3.9.egg/langchain/agents/tools.py", line 8, in from langchain.tools.base import BaseTool, Tool, tool File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain-0.0.231-py3.9.egg/langchain/tools/init.py", line 3, in from langchain.tools.arxiv.tool import ArxivQueryRun File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain-0.0.231-py3.9.egg/langchain/tools/arxiv/tool.py", line 12, in from langchain.utilities.arxiv import ArxivAPIWrapper File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain-0.0.231-py3.9.egg/langchain/utilities/init.py", line 3, in from langchain.utilities.apify import ApifyWrapper File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain-0.0.231-py3.9.egg/langchain/utilities/apify.py", line 5, in from langchain.document_loaders import ApifyDatasetLoader File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain-0.0.231-py3.9.egg/langchain/document_loaders/init.py", line 55, in from langchain.document_loaders.github import GitHubIssuesLoader File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/langchain-0.0.231-py3.9.egg/langchain/document_loaders/github.py", line 37, in class GitHubIssuesLoader(BaseGitHubLoader): File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydantic-1.10.7-py3.9.egg/pydantic/main.py", line 197, in new fields[ann_name] = ModelField.infer( File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydantic-1.10.7-py3.9.egg/pydantic/fields.py", line 506, in infer return cls( File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydantic-1.10.7-py3.9.egg/pydantic/fields.py", line 436, in init self.prepare() File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydantic-1.10.7-py3.9.egg/pydantic/fields.py", line 552, in prepare self._type_analysis() File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydantic-1.10.7-py3.9.egg/pydantic/fields.py", line 663, in _type_analysis self.sub_fields = [self._create_subtype(t, f'{self.name}{display_astype(t)}') for t in types] File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydantic-1.10.7-py3.9.egg/pydantic/fields.py", line 663, in self.sub_fields = [self._create_subtype(t, f'{self.name}{display_astype(t)}') for t in types] File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydantic-1.10.7-py3.9.egg/pydantic/fields.py", line 808, in _create_sub_type return self.class( File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydantic-1.10.7-py3.9.egg/pydantic/fields.py", line 436, in init self.prepare() File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydantic-1.10.7-py3.9.egg/pydantic/fields.py", line 552, in prepare self._type_analysis() File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pydantic-1.10.7-py3.9.egg/pydantic/fields.py", line 668, in _type_analysis elif issubclass(origin, Tuple): # type: ignore File "/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/typing.py", line 852, in subclasscheck return issubclass(cls, self.origin) TypeError: issubclass() arg 1 must be a class

NextThread commented 1 year ago

hey, I'd like to work on this issue

voidking commented 1 year ago

Check all your dependency versions please. https://github.com/geekan/MetaGPT/blob/main/requirements.txt

abanobboles commented 1 year ago

The error is still existing

abanobboles commented 1 year ago

@voidking

better629 commented 1 year ago

@abanobboles @gaoxunyang check the version of typing-inspect and typing_extensions to confirm if it matchs

typing-inspect==0.8.0
typing_extensions==4.5.0

or update it to pydantic==1.10.8.

royale1223 commented 1 year ago

Still happening with the above mentioned deps.

better629 commented 1 year ago

@royale1223 Can you provide your python version、pkgs version about langchain、faiss、pydantic、typing-inspect、typing_extensions and platform(Mac or others)?

royale1223 commented 1 year ago

@better629

Python 3.11.5 langchain==0.0.231 faiss_cpu==1.7.4 pydantic==1.10.8 typing-inspect==0.8.0 typing_extensions==4.5.0 Mac OS Ventura

better629 commented 3 weeks ago

Due to the lack of updates or replies by the user for a long time, we will close it. Please reopen it if necessary.