llama_index: [Bug]: import error generated by SimpleDirectoryReader()
Bug Description
After upgrading to 0.10.4 SimpleDirectoryReader() generates an import error as it cannot find “DocxReader” in “llama_index.readers.file”.
Version
0.10.3
Steps to Reproduce
import openai import os import llama_index.core.readers as readers
openai.api_key = os.environ[‘OPENAI_API_KEY’]
source_dir_html = ‘/home/wb200/data/llm/doc/MLX_AU/test/html/’
reader = readers.SimpleDirectoryReader(input_dir=source_dir_html) documents = reader.load_data()
Relevant Logs/Tracbacks
Traceback (most recent call last):
File "/home/wb200/anaconda3/envs/llm/lib/python3.11/site-packages/llama_index/core/readers/file/base.py", line 21, in _try_loading_included_file_formats
from llama_index.readers.file import (
ImportError: cannot import name 'DocxReader' from 'llama_index.readers.file' (unknown location)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/wb200/python/LLM/test.py", line 13, in <module>
documents = reader.load_data()
^^^^^^^^^^^^^^^^^^
File "/home/wb200/anaconda3/envs/llm/lib/python3.11/site-packages/llama_index/core/readers/file/base.py", line 396, in load_data
SimpleDirectoryReader.load_file(
File "/home/wb200/anaconda3/envs/llm/lib/python3.11/site-packages/llama_index/core/readers/file/base.py", line 303, in load_file
default_file_reader_cls = SimpleDirectoryReader.supported_suffix_fn()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/wb200/anaconda3/envs/llm/lib/python3.11/site-packages/llama_index/core/readers/file/base.py", line 35, in _try_loading_included_file_formats
raise ImportError("`llama-index-readers-file` package not found")
ImportError: `llama-index-readers-file` package not found
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 19 (4 by maintainers)
@datascientist
pip install -U llama-index-readers-fileI’m surprised you had this issue, unless you only installed core
Thanks, this solved the issue without creating a new environment.
@damsdams1995 I fixed the issue with this:
I created a new env with conda and didn’t encounter this issue again. thanks
I have already downloaded the llama-index-readers-file, same issue 😃
On Wed, 21 Feb 2024 at 15:58, Manjunath Janardhan @.***> wrote:
Same here
Haven’t tried that yet as I’m used to conda env system. And it doesn’t seem to work there.