from llama_index import SimpleDirectoryReader, ServiceContext, VectorStoreIndex
from llama_index.llms import OpenAI
Upon trying the above imports I get the following error:
ImportError: cannot import name 'SimpleDirectoryReader' from 'llama_index' (unknown location)
Along with:
ModuleNotFoundError: No module named 'llama_index.llms'
I have tried importing llama index via both pip and directly from github.
I am using 0.7.18 version of llama-index.
If you're encountering import errors with llama_index, such as:
ImportError: cannot import name 'SimpleDirectoryReader' from 'llama_index' (unknown location) ModuleNotFoundError: No module named 'llama_index.llms' And you're using version 0.7.18 of llama-index, the solution lies in the recent updates to the library. The structure of imports has been modified, which requires adjusting how you import specific components.
To resolve these import errors, you should update your import statements to reflect the new structure as per the latest documentation. For instance:
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
It was deprecated. Use as follows:
from llama_index.core import SimpleDirectoryReader, ServiceContext, VectorStoreIndex
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With