jlonge4 / local_llama

This repo is to showcase how you can run a model locally and offline, free of OpenAI dependencies.
Apache License 2.0
240 stars 39 forks source link

ImportError: cannot import name 'download_loader' from 'llama_index' #2

Open 94bb494nd41f opened 1 year ago

94bb494nd41f commented 1 year ago

so i did a fresh install (pip install -r requirements.txt) in conda and stumbled across this error

As you might see in my profile i do not open issues that often, please tell me if i need to provide more information

Network URL: http://192.168.178.82:8501

2023-05-24 20:16:32.238 Uncaught app exception
Traceback (most recent call last):
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "C:\Users\derdi\local_llama\local_llama.py", line 2, in <module>
    from llama_index import download_loader, SimpleDirectoryReader, ServiceContext, LLMPredictor, GPTVectorStoreIndex, \
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\__init__.py", line 18, in <module>
    from llama_index.indices.common.struct_store.base import SQLDocumentContextBuilder
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\__init__.py", line 4, in <module>
    from llama_index.indices.keyword_table.base import GPTKeywordTableIndex
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\keyword_table\__init__.py", line 4, in <module>
    from llama_index.indices.keyword_table.base import GPTKeywordTableIndex
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\keyword_table\base.py", line 18, in <module>
    from llama_index.indices.base import BaseGPTIndex
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\base.py", line 8, in <module>
    from llama_index.indices.base_retriever import BaseRetriever
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\base_retriever.py", line 5, in <module>
    from llama_index.indices.query.schema import QueryBundle, QueryType
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\query\__init__.py", line 3, in <module>
    from llama_index.indices.query.response_synthesis import ResponseSynthesizer
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\query\response_synthesis.py", line 5, in <module>
    from llama_index.indices.postprocessor.types import BaseNodePostprocessor
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\postprocessor\__init__.py", line 4, in <module>
    from llama_index.indices.postprocessor.node import (
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\postprocessor\node.py", line 236, in <module>
    class AutoPrevNextNodePostprocessor(BasePydanticNodePostprocessor):
  File "pydantic\main.py", line 197, in pydantic.main.ModelMetaclass.__new__
  File "pydantic\fields.py", line 506, in pydantic.fields.ModelField.infer
  File "pydantic\fields.py", line 436, in pydantic.fields.ModelField.__init__
  File "pydantic\fields.py", line 557, in pydantic.fields.ModelField.prepare
  File "pydantic\fields.py", line 831, in pydantic.fields.ModelField.populate_validators
  File "pydantic\validators.py", line 725, in find_validators
  File "pydantic\dataclasses.py", line 478, in make_dataclass_validator
  File "pydantic\dataclasses.py", line 231, in pydantic.dataclasses.dataclass
  File "pydantic\dataclasses.py", line 224, in pydantic.dataclasses.dataclass.wrap
  File "pydantic\dataclasses.py", line 347, in pydantic.dataclasses._add_pydantic_validation_attributes
  File "pydantic\dataclasses.py", line 400, in pydantic.dataclasses.create_pydantic_model_from_dataclass
  File "pydantic\main.py", line 1026, in pydantic.main.create_model
  File "pydantic\main.py", line 197, in pydantic.main.ModelMetaclass.__new__
  File "pydantic\fields.py", line 506, in pydantic.fields.ModelField.infer
  File "pydantic\fields.py", line 436, in pydantic.fields.ModelField.__init__
  File "pydantic\fields.py", line 552, in pydantic.fields.ModelField.prepare
  File "pydantic\fields.py", line 639, in pydantic.fields.ModelField._type_analysis
  File "C:\Users\derdi\.conda\envs\quanization\lib\typing.py", line 1498, in __instancecheck__
    raise TypeError("Instance and class checks can only be used with"
TypeError: Instance and class checks can only be used with @runtime_checkable protocols
2023-05-24 20:16:32.512 Uncaught app exception
Traceback (most recent call last):
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "C:\Users\derdi\local_llama\local_llama.py", line 2, in <module>
    from llama_index import download_loader, SimpleDirectoryReader, ServiceContext, LLMPredictor, GPTVectorStoreIndex, \
ImportError: cannot import name 'download_loader' from 'llama_index' (C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\__init__.py)
2023-05-24 20:16:32.514 Uncaught app exception
Traceback (most recent call last):
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "C:\Users\derdi\local_llama\local_llama.py", line 2, in <module>
    from llama_index import download_loader, SimpleDirectoryReader, ServiceContext, LLMPredictor, GPTVectorStoreIndex, \
ImportError: cannot import name 'download_loader' from 'llama_index' (C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\__init__.py)
2023-05-24 20:16:32.596 Uncaught app exception
Traceback (most recent call last):
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "C:\Users\derdi\local_llama\local_llama.py", line 2, in <module>
    from llama_index import download_loader, SimpleDirectoryReader, ServiceContext, LLMPredictor, GPTVectorStoreIndex, \
ImportError: cannot import name 'download_loader' from 'llama_index' (C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\__init__.py)

Edit: created a ticket https://github.com/jerryjliu/llama_index/issues/3869

94bb494nd41f commented 1 year ago

switching to python 3.9.16 avoids the error