llama_index icon indicating copy to clipboard operation
llama_index copied to clipboard

cannot import name 'BaseOutputParser' from 'langchain.schema'

Open shangdev opened this issue 2 years ago • 3 comments

When I upgrade llama_index to v0.4.26, this error occurs:

Traceback (most recent call last):
  File "D:\www\llamaIndexDemo\sqlDemo.py", line 5, in <module>
    from llama_index import GPTSQLStructStoreIndex, SQLDatabase
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\__init__.py", line 18, in <module>
    from llama_index.indices.common.struct_store.base import SQLDocumentContextBuilder
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\indices\__init__.py", line 4, in <module>
    from llama_index.indices.keyword_table.base import GPTKeywordTableIndex
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\indices\keyword_table\__init__.py", line 4, in <module>
    from llama_index.indices.keyword_table.base import GPTKeywordTableIndex
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\indices\keyword_table\base.py", line 16, in <module>
    from llama_index.indices.base import DOCUMENTS_INPUT, BaseGPTIndex
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\indices\base.py", line 23, in <module>
    from llama_index.indices.prompt_helper import PromptHelper
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\indices\prompt_helper.py", line 12, in <module>
    from llama_index.langchain_helpers.chain_wrapper import LLMPredictor
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\langchain_helpers\chain_wrapper.py", line 6, in <module>
    from llama_index.llm_predictor.base import (  # noqa: F401
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\llm_predictor\__init__.py", line 4, in <module>
    from llama_index.llm_predictor.base import LLMPredictor
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\llm_predictor\base.py", line 15, in <module>
    from llama_index.prompts.base import Prompt
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\prompts\__init__.py", line 3, in <module>
    from llama_index.prompts.base import Prompt
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\prompts\base.py", line 11, in <module>
    from llama_index.output_parsers.base import BaseOutputParser
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\output_parsers\__init__.py", line 4, in <module>
    from llama_index.output_parsers.langchain import LangchainOutputParser
  File "D:\Program Files\Python\Python311\Lib\site-packages\llama_index\output_parsers\langchain.py", line 6, in <module>
    from langchain.schema import BaseOutputParser as LCOutputParser
ImportError: cannot import name 'BaseOutputParser' from 'langchain.schema' (D:\Program Files\Python\Python311\Lib\site-packages\langchain\schema.py)

shangdev avatar Mar 24 '23 10:03 shangdev

This is requirements.txt:

llama-index==0.4.36
mysql-connector-python==8.0.32

shangdev avatar Mar 24 '23 10:03 shangdev

Getting the same error with llama-index===0.4.35

Krumil avatar Mar 24 '23 10:03 Krumil

Upgrade the langchain. It work for me. pip install --upgrade langchain

suling-fun avatar Mar 24 '23 14:03 suling-fun

add langchain==0.0.123 latest version to requirements.txt solve it.

shangdev avatar Mar 25 '23 01:03 shangdev