Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
magick93 opened this issue Aug 1, 2023 · 1 comment

Comments

@magick93
Copy link

magick93 commented Aug 1, 2023

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
Copy link

Razbolt commented Aug 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants