Install & Compatibility
Where this runs
tested against v0.5.7 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 259.2MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 20.5s · import 0.000s · 255MB
269MB installed
● package 269MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
RagCLI
✓ from llama_index.cli.rag_cli import RagCLI
✗ from llama_index.cli.rag_cli import RagCLI
This quickstart demonstrates how to use the `llamaindex-cli` tool to ingest a local file and query it using Retrieval-Augmented Generation (RAG). It requires an OpenAI API key by default. Note that `llama-index-cli` is deprecated; for new projects, consider using `create-llama` or directly integrating with the `llama-index` Python library.
import os
import subprocess
# NOTE: llama-index-cli is deprecated. Use the main llama-index library
# or the 'create-llama' CLI for new projects.
# 1. Set your OpenAI API key (required by default for embeddings/LLM)
# Replace 'YOUR_OPENAI_API_KEY' with your actual key or set it as an env var.
os.environ['OPENAI_API_KEY'] = os.environ.get('OPENAI_API_KEY', 'YOUR_OPENAI_API_KEY')
# Create a dummy file for demonstration
with open('example.txt', 'w') as f:
f.write('LlamaIndex is a data framework for LLM applications. It helps connect custom data sources with LLMs.')
print("Ingesting 'example.txt' and asking a question via llamaindex-cli...")
# 2. Ingest a file and ask a question
try:
result = subprocess.run(
['llamaindex-cli', 'rag', '--files', 'example.txt', '--question', 'What is LlamaIndex?'],
capture_output=True, text=True, check=True
)
print("--- CLI Output ---")
print(result.stdout)
if result.stderr:
print("--- CLI Errors (if any) ---")
print(result.stderr)
except FileNotFoundError:
print("Error: 'llamaindex-cli' command not found. Ensure the package is installed and in your PATH.")
except subprocess.CalledProcessError as e:
print(f"Error running command: {e}")
print(f"Stdout: {e.stdout}")
print(f"Stderr: {e.stderr}")
# Clean up the dummy file
os.remove('example.txt')
llamaindex-cli --version
Debug
Known issues
deprecatedThe `llama-index-cli` package is officially deprecated and no longer maintained. It will not receive further updates or bug fixes. Users are advised to consider alternatives such as the `create-llama` CLI tool for scaffolding LlamaIndex projects or interacting directly with the core `llama-index` Python library.fixMigrate to `create-llama` (for project scaffolding) or the main `llama-index` library for programmatic RAG workflows.
affects: 0.5.7 and older
gotchaBy default, `llama-index-cli` uses OpenAI for embeddings and LLM, which requires setting the `OPENAI_API_KEY` environment variable. This means that, by default, any local data ingested with this tool will be sent to OpenAI's API.fixSet the `OPENAI_API_KEY` environment variable or customize the CLI tool to use local models or other providers. Check LlamaIndex documentation for customization options.
affects: All versions
breakingUpgrading the underlying `llama-index` library to versions v0.10.0 and above introduced significant breaking changes, including a massive packaging refactor, deprecation of `ServiceContext`, and changes to import paths. While `llama-index-cli` itself is deprecated, users might encounter issues if their `llama-index` dependency is updated.fixRefer to the LlamaIndex v0.10 Migration Guide for changes in `llama-index` core. The `llama-index-cli` package included an `upgrade-file` command to assist with these migrations, though its utility is limited now due to the CLI's deprecation.
affects: llama-index >= 0.10.0 (dependency of llama-index-cli)
gotchaUsers installing `llama-index-cli` alongside `chromadb` (a default dependency for RAG) may encounter dependency conflicts, particularly with `onnxruntime` in certain environments (e.g., Conda). This can lead to installation failures.fixConsider installing `onnxruntime` separately with `SYSTEM_VERSION_COMPAT=0 pip install --no-cache-dir 'onnxruntime>=1.17.1'` before installing `llama-index-cli` and `chromadb`, or use a fresh virtual environment.
affects: All versions
Upgrade
Version history
0.5.7latest on PyPI · released Apr 2, 2026
Audit
Dependencies
llama-indexrequiredCore LlamaIndex functionality that the CLI operates upon.
chromadboptionalDefault vector database used by the RAG CLI tool.
pypdfoptionalFor PDF file parsing when ingesting PDF documents.