Jenil Ginoya
Jenil Ginoya

Reputation: 1

ModuleNotFoundError: No module named 'llama_index.text_splitter'

I used this to import

from llama_index.text_splitter import SentenceSplitter

and my python version - 3.11.5 and llama_index version - 0.12.8 but give this error

ModuleNotFoundError: No module named 'llama_index.text_splitter

How to solve this?

I ask to chatgpt, google other AI but can't find the solution.

Upvotes: 0

Views: 154

Answers (1)

dev_light
dev_light

Reputation: 4096

The SentenceSplitter class is defined in the llama_index.text_splitter module. So, your error might be due to one of the following reasons:

  • The llama_index package is not installed or not properly installed in your Python environment. You can check this by running pip show llama_index in your terminal. If the package is not installed, you can install it in a terminal session by running: pip install llama_index.
  • The llama_index package is installed, but Python cannot find it. This can happen if the package is installed in a location that is not on Python's path. You can check Python's path in your script using:
import sys
print(sys.path)
  • The llama_index.text_splitter module is not correctly imported in the __init__.py file of the llama_index package. This would prevent you from importing SentenceSplitter directly from llama_index.text_splitter.

See this closed similar issue on GitHub.

Upvotes: 0

Related Questions