Error database

ModuleNotFoundError: No module named 'llama_index' (v0.10 restructure)

LlamaIndex v0.10 split into llama-index-core plus integration packages, and old imports broke. Reinstall cleanly and import from llama_index.core.

The message you saw
ModuleNotFoundError: No module named 'llama_index' (v0.10 restructure)

By Updated

The error

Output
ModuleNotFoundError: No module named 'llama_index'

Or, with the package installed but code from the wrong era:

Output
ImportError: cannot import name 'VectorStoreIndex' from 'llama_index'
ModuleNotFoundError: No module named 'llama_index.core'

What it means

LlamaIndex restructured in v0.10 (February 2024). The single llama_index package became llama-index-core plus hundreds of small integration packages (llama-index-llms-openai, llama-index-embeddings-huggingface, ...), with llama-index remaining as a starter bundle. Import paths changed with it: top-level classes moved under llama_index.core. Errors here are almost always a version/imports mismatch — old code on new installs, or a half-upgraded environment with remnants of both eras.

Why it happens

Upgrading in place from pre-0.10 leaves conflicting files behind — the old package layout and the new namespace packages fight, producing imports that fail in confusing ways. And tutorials written before the restructure use from llama_index import ..., which no longer resolves.

How to fix it

1. Reinstall cleanly. For an environment that ever held an old version:

bash
pip uninstall -y llama-index llama-index-core
pip install -U llama-index

For stubborn cases, a fresh virtual environment is quicker than untangling remnants — the maintainers recommended exactly that for the v0.10 migration.

2. Update the imports to the core namespace.

python
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.llms.openai import OpenAI
from llama_index.embeddings.huggingface import HuggingFaceEmbedding

The pattern: framework primitives under llama_index.core, each integration under its own subpath.

3. Install the integrations you import. The bundle covers OpenAI basics; anything else is its own pip package:

bash
pip install llama-index-embeddings-huggingface llama-index-vector-stores-chroma

The import path predicts the package name: llama_index.vector_stores.chroma lives in llama-index-vector-stores-chroma.

4. In notebooks, restart after installing, and confirm which environment got the package.

python
import sys; print(sys.executable)

The generic environment-mismatch causes from the module-not-found page apply here fully.

How to prevent it

For any LlamaIndex project older than the restructure, budget a migration pass instead of patching import-by-import. Pin llama-index-core and each integration in requirements so environments rebuild identically, and take import syntax from the current docs when starting anything new.