Install & Compatibility
Where this runs
tested against v0.14.24 · 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 4.247s · 375.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 21.8s · import 3.954s · 439MB
424MB installed
● package 424MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
VectorStoreIndex
✓ from llama_index.core import VectorStoreIndex
SimpleDirectoryReader
✓ from llama_index.core import SimpleDirectoryReader
Settings
✓ from llama_index.core import Settings
✗ from llama_index.core import ServiceContext
`ServiceContext` was deprecated in LlamaIndex 0.10.0 and replaced by the global `Settings` object for configuring LLM, embedding model, and other core components.
OpenAI
✓ from llama_index.llms.openai import OpenAI
✗ from llama_index.llms import OpenAI
As of LlamaIndex 0.10.0, LLM and Embedding models are imported from their specific integration packages (e.g., `llama_index.llms.openai`).
OpenAIEmbedding
✓ from llama_index.embeddings.openai import OpenAIEmbedding
✗ from llama_index.embeddings import OpenAIEmbedding
As of LlamaIndex 0.10.0, LLM and Embedding models are imported from their specific integration packages (e.g., `llama_index.embeddings.openai`).
This quickstart demonstrates how to load a document, create a vector index, and query it using the default OpenAI LLM and embedding models. It highlights the use of the `Settings` object for configuration, which replaced `ServiceContext` in LlamaIndex 0.10.0+.
import os
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.llms.openai import OpenAI
from llama_index.embeddings.openai import OpenAIEmbedding
# Ensure you have OPENAI_API_KEY set in your environment variables
# For quick testing, a dummy key is used, but a real key is needed for actual API calls.
os.environ["OPENAI_API_KEY"] = os.environ.get("OPENAI_API_KEY", "sk-DUMMY")
# Create a dummy data directory and file for the example
if not os.path.exists("data"):
os.makedirs("data")
with open("data/sample_doc.txt", "w") as f:
f.write("LlamaIndex is a data framework for building LLM applications.")
f.write("It helps connect custom data sources to large language models.")
try:
# Configure the global Settings object (replaces ServiceContext)
Settings.llm = OpenAI(model="gpt-3.5-turbo")
Settings.embed_model = OpenAIEmbedding(model="text-embedding-ada-002")
Settings.chunk_size = 1024
# 1. Load documents from a directory
documents = SimpleDirectoryReader("data").load_data()
# 2. Create an index from the documents
index = VectorStoreIndex.from_documents(documents)
# 3. Create a query engine and query the index
query_engine = index.as_query_engine()
response = query_engine.query("What is LlamaIndex?")
print(f"Query: What is LlamaIndex?")
print(f"Response: {response.response}")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure you have `OPENAI_API_KEY` set and `llama-index-llms-openai` and `llama-index-embeddings-openai` installed.")
finally:
# Clean up dummy file and directory
if os.path.exists("data/sample_doc.txt"):
os.remove("data/sample_doc.txt")
if os.path.exists("data"):
os.rmdir("data")
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'llama_index.readers.base'
LlamaIndex underwent a major refactoring in version 0.10.0, moving many core modules and classes into a `llama_index.core` namespace or dedicated sub-packages, causing older import paths to break.
fixUpdate your import statements to use `llama_index.core` for core components or install/import from the specific namespaced package (e.g., `llama-index-readers-file`, `llama-index-llms-openai`). For `readers`, you might need `from llama_index.readers.file import SimpleDirectoryReader` or `from llama_index.core.readers import SimpleDirectoryReader` depending on the specific reader and installation.
ImportError: cannot import name 'Document' from 'llama_index' (unknown location)
Following a major refactor in LlamaIndex (post 0.10.0), many core classes like `Document`, `VectorStoreIndex`, and `SimpleDirectoryReader` were moved into the `llama_index.core` module.
fixChange the import statement to `from llama_index.core import Document` (or `VectorStoreIndex`, `SimpleDirectoryReader`, etc.)
ValueError: Could not load OpenAI model. If you intended to use OpenAI, please check your OPENAI_API_KEY.
LlamaIndex defaults to using OpenAI models and expects the `OPENAI_API_KEY` environment variable to be set, even if you intend to use a different LLM or embedding model, unless explicitly configured otherwise.
fixSet the `OPENAI_API_KEY` environment variable, or explicitly configure `Settings.llm` and `Settings.embed_model` to use a non-OpenAI provider before any LlamaIndex operations, for example: `os.environ["OPENAI_API_KEY"] = "sk-..."` or `Settings.llm = CustomLLM()` and `Settings.embed_model = CustomEmbedding()`.
Cannot find LLM, please set `Settings.llm = ...` on the top of your code.
The LlamaIndex framework requires an LLM (Large Language Model) to be configured globally via the `Settings` object before performing operations that depend on an LLM, such as generating responses or building indexes.
fixSet the global LLM in the `Settings` object, for example: `from llama_index.llms.openai import OpenAI
from llama_index.core import Settings
Settings.llm = OpenAI(model='gpt-3.5-turbo')`.
Upgrade
Version history
0.14.24latest on PyPI · released Aug 19, 2026
Audit
Dependencies
openairequiredCommonly used LLM provider. Must be installed separately (e.g., via `llama-index-llms-openai`).
pydanticrequiredUsed heavily for data validation and configuration. The minimum required version might increase with future LlamaIndex updates.