Installation
Requirements
- Python 3.10+ (3.11 / 3.12 recommended)
- pip, or uv / poetry
- At least one LLM provider API key (OpenAI in this course)
The ecosystem is core + namespaced integrations. pip install llama-index is the starter bundle; extra readers and vector stores are opt-in. Full catalog: LlamaHub.
Virtual environment
Install packages
Official quickstart:
The bundle typically includes:
llama-index-core ships some NLTK / tiktoken files so those downloads are less likely at runtime.
Local models instead of OpenAI (example):
Vector stores (see Vector Stores):
Verify:
API keys
Historically the default generation model was gpt-3.5-turbo and embeddings text-embedding-ada-002. This course uses gpt-4o-mini and defers to current official docs. OpenAI still needs OPENAI_API_KEY.
Environment variables (recommended)
Windows PowerShell:
.env file
Never commit .env. OpenAI-compatible gateways can use the documented OpenAILike LLM / embedding classes with a custom api_base.
Global Settings (set these early)
When you omit a component, LlamaIndex uses Settings. Set them explicitly so defaults cannot drift:
Local Ollama example:
Suggested layout
Troubleshooting
OPENAI_API_KEY errors?
The variable is missing in this process. IDE terminals and system shells can differ.
First query is slow / re-embeds every time?
The default index is in-memory. Call index.storage_context.persist(...) or attach a vector DB—Quick Start, Vector Stores.
ModuleNotFoundError: llama_index.vector_stores.chroma?
Core does not vendor every store. Install the matching llama-index-vector-stores-* package.
Dependency conflicts?
Fresh venv; do not mix with llama-index<0.10 (ServiceContext was replaced by Settings).