Registry /
llm-agents / llama-index-readers-file
Install & Compatibility
Where this runs
tested against v0.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 5.348s · 322.5MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 23.7s · import 4.926s · 315MB
335MB installed
● package 335MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
FlatReader
✓ from llama_index.readers.file import FlatReader
For loading plain text files.
PDFReader
✓ from llama_index.readers.file import PDFReader
For loading PDF documents. Requires 'pypdf' extra.
DocxReader
✓ from llama_index.readers.file import DocxReader
For loading DOCX documents. Requires 'docx2txt' extra.
CSVFileReader
✓ from llama_index.readers.file import CSVFileReader
For loading CSV files. Requires 'pandas' extra.
This quickstart demonstrates how to use the `FlatReader` from `llama-index-readers-file` to load a plain text document. It creates a temporary file, loads its content into LlamaIndex Document objects, and prints a snippet of the loaded text. Remember to install the `llama-index-readers-file` package.
import tempfile
from pathlib import Path
from llama_index.readers.file import FlatReader
# Create a dummy text file
file_content = "This is a sample document for LlamaIndex. It contains some text."
with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt') as tmp_file:
tmp_file.write(file_content)
tmp_file_path = Path(tmp_file.name)
# Initialize the FlatReader
reader = FlatReader()
# Load data from the temporary file
documents = reader.load_data(file=tmp_file_path)
# Print the content of the first document
if documents:
print(f"Loaded document content: {documents[0].text[:100]}...")
print(f"Metadata: {documents[0].metadata}")
# Clean up the temporary file
tmp_file_path.unlink()
Debug
Known issues
breakingPrior to LlamaIndex v0.10.x, some file readers might have been directly available within the main `llama_index` package. With the modularization, specific readers now reside in sub-packages like `llama-index-readers-file` and require a separate installation.fixEnsure `pip install llama-index-readers-file` is executed. Update import paths from `llama_index.readers.*` to `llama_index.readers.file.*`.
affects: Pre-0.10.x to 0.10.x and later
gotchaMany specific file type readers (e.g., PDFReader, DocxReader, CSVFileReader) rely on additional third-party libraries that are not installed by default with `llama-index-readers-file`. You must install these optional dependencies explicitly.fixInstall the required extras, e.g., `pip install llama-index-readers-file[pdf]` for PDF support, or `pip install pypdf` manually. Check the `pyproject.toml` or documentation for a full list of extras.
affects: All versions
gotchaWhen dealing with complex documents (e.g., PDFs with tables, scanned images, or nested structures), `FlatReader` or basic type-specific readers may not extract content optimally. For advanced parsing, consider `UnstructuredReader` (available in `llama-index-readers-unstructured`).fixFor basic text extraction, `FlatReader` from `llama-index-readers-file` is sufficient. For rich content, install `pip install llama-index-readers-unstructured` and use `UnstructuredReader`.
affects: All versions
Errors
Common errors & fixes
ImportError: `llama-index-readers-file` package not found
This error typically occurs when the `llama-index-readers-file` package is not correctly installed, or there's a conflict in the Python environment, particularly after updates to the LlamaIndex core library. It might also be installed in a different virtual environment than the one being used.
fixEnsure the package is installed and up-to-date by running: `pip install -U llama-index-readers-file`. If the issue persists, try a clean reinstallation in a fresh virtual environment: `pip uninstall llama-index llama-index-readers-file && pip install -U llama-index --no-cache-dir --force-reinstall llama-index-readers-file`.
ImportError: docx2txt is required to read Microsoft Word files: `pip install docx2txt`
The `DocxReader` component within `llama-index-readers-file` relies on the `docx2txt` Python library to parse and extract text from `.docx` files, and this specific dependency is not installed in your environment.
fixInstall the missing dependency: `pip install docx2txt`.
Failed to load file [...].pdf with error: RetryError[<Future at ... state=finished raised DependencyError]
When using `SimpleDirectoryReader` or `PDFReader` to process PDF files, an underlying dependency like `PyMuPDF` (also known as `fitz`) or `PyPDF2` is required for PDF parsing and is missing.
fixInstall the necessary PDF parsing library, typically `PyMuPDF`: `pip install PyMuPDF`. Alternatively, `pip install PyPDF2` can be used.
TesseractNotFoundError: tesseract is not installed or it's not in your path
This error occurs when the `ImageReader` attempts to perform Optical Character Recognition (OCR) on image files but cannot find the Tesseract OCR engine installed on the system, or its executable is not correctly added to the system's PATH environment variable, even if the `pytesseract` Python wrapper is installed.
fix1. Install the Tesseract OCR engine on your operating system (e.g., `sudo apt-get install tesseract-ocr` on Ubuntu, or download an installer for Windows). 2. Ensure the Tesseract executable's directory is added to your system's PATH environment variable. 3. Install the Python wrapper: `pip install pytesseract`.
Upgrade
Version history
0.6.0latest on PyPI · released Mar 12, 2026
Audit
Dependencies
llama-index-corerequiredRequired base library for LlamaIndex components.
pypdfoptionalRequired for PDFReader functionality.
docx2txtoptionalRequired for DocxReader functionality.
pandasoptionalRequired for CSVFileReader and ExcelReader functionality.
unstructuredoptionalRequired for ImageReader, HTMLReader, and advanced file parsing.