langchain-ai / web-explorer

356 stars 82 forks source link

cannot import name 'RetrievalQA' from partially initialized module 'langchain.chains' (most likely due to a circular import) #8

Open magick93 opened 11 months ago

magick93 commented 11 months ago

Hello

I'm getting the following error. I'm using Python 3.10.0.

Output

2023-08-02 10:22:05.807 Uncaught app exception
Traceback (most recent call last):
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
  File "/home/bob/bit/myproject/web-explorer/web_explorer.py", line 2, in <module>
    from langchain.callbacks.base import BaseCallbackHandler
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/__init__.py", line 6, in <module>
    from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/agents/__init__.py", line 2, in <module>
    from langchain.agents.agent import (
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/agents/agent.py", line 15, in <module>
    from langchain.agents.agent_iterator import AgentExecutorIterator
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/agents/agent_iterator.py", line 30, in <module>
    from langchain.tools import BaseTool
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/tools/__init__.py", line 60, in <module>
    from langchain.tools.powerbi.tool import (
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/tools/powerbi/tool.py", line 12, in <module>
    from langchain.chains.llm import LLMChain
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/chains/llm.py", line 18, in <module>
    from langchain.prompts.prompt import PromptTemplate
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/prompts/__init__.py", line 20, in <module>
    from langchain.prompts.loading import load_prompt
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/prompts/loading.py", line 10, in <module>
    from langchain.output_parsers.regex import RegexParser
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/output_parsers/__init__.py", line 5, in <module>
    from langchain.output_parsers.fix import OutputFixingParser
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/output_parsers/fix.py", line 5, in <module>
    from langchain.chains.llm import LLMChain
ImportError: cannot import name 'LLMChain' from partially initialized module 'langchain.chains.llm' (most likely due to a circular import) (/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/chains/llm.py)
2023-08-02 10:22:06.179 Uncaught app exception
Traceback (most recent call last):
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
  File "/home/bob/bit/myproject/web-explorer/web_explorer.py", line 3, in <module>
    from langchain.chains import RetrievalQAWithSourcesChain
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/chains/__init__.py", line 16, in <module>
    from langchain.chains.api.openapi.chain import OpenAPIEndpointChain
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/__init__.py", line 6, in <module>
    from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/agents/__init__.py", line 2, in <module>
    from langchain.agents.agent import (
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/agents/agent.py", line 15, in <module>
    from langchain.agents.agent_iterator import AgentExecutorIterator
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/agents/agent_iterator.py", line 30, in <module>
    from langchain.tools import BaseTool
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/tools/__init__.py", line 94, in <module>
    from langchain.tools.vectorstore.tool import (
  File "/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/tools/vectorstore/tool.py", line 12, in <module>
    from langchain.chains import RetrievalQA, RetrievalQAWithSourcesChain
ImportError: cannot import name 'RetrievalQA' from partially initialized module 'langchain.chains' (most likely due to a circular import) (/home/bob/bit/myproject/web-explorer/.venv/lib/python3.10/site-packages/langchain/chains/__init__.py)
Razbolt commented 11 months ago

Hey funny but delete and re upload the langchain, it will work.