ImportError: cannot import name 'VectorStoreIndex' (or ServiceContext, OpenAI, any name) from 'llama_index...': which LlamaIndex releases have it
LlamaIndex 0.10.0 (2024-02-10) moved the whole old top level into llama_index.core and split every integration into its own package; 0.9.48 is the last release with the old layout. from llama_index import VectorStoreIndex becomes from llama_index.core import VectorStoreIndex. from llama_index.llms import OpenAI becomes pip install llama-index-llms-openai and from llama_index.llms.openai import OpenAI; embeddings, vector stores and readers work the same way. ServiceContext still imports but fails from 0.11.0: use Settings. llama-index-core 0.13.0 removed the old agents (AgentRunner) and QueryPipeline, and 0.14.21 removed download_loader. For any other name, paste the error below; the lookup gives the new import and the package for 580 old names.
Examples:
Runs in your browser on llama_index.json (610 KB) and 105 KB of hints in this page; nothing you paste is sent anywhere. Covers 24,694 module-and-name pairs in 1,362 modules.
What replaces the old imports, and which package do I install?
The new import for each old name comes from LlamaIndex's own upgrade map (llama_index/core/command_line/mappings.json, 1,089 names, 708 of them in integration packages); the package name follows the rule its llamaindex-cli upgrade uses. Common ones:
| Before 0.10.0 | From 0.10.0 | Package |
|---|---|---|
from llama_index import VectorStoreIndex | from llama_index.core import VectorStoreIndex | llama-index-core |
from llama_index import SimpleDirectoryReader | from llama_index.core import SimpleDirectoryReader | llama-index-core |
from llama_index import StorageContext | from llama_index.core import StorageContext | llama-index-core |
from llama_index import load_index_from_storage | from llama_index.core import load_index_from_storage | llama-index-core |
from llama_index import Document | from llama_index.core import Document | llama-index-core |
from llama_index import PromptTemplate | from llama_index.core import PromptTemplate | llama-index-core |
from llama_index.llms import OpenAI | from llama_index.llms.openai import OpenAI | llama-index-llms-openai |
from llama_index.embeddings import OpenAIEmbedding | from llama_index.embeddings.openai import OpenAIEmbedding | llama-index-embeddings-openai |
from llama_index.embeddings import HuggingFaceEmbedding | from llama_index.embeddings.huggingface import HuggingFaceEmbedding | llama-index-embeddings-huggingface |
from llama_index.vector_stores import ChromaVectorStore | from llama_index.vector_stores.chroma import ChromaVectorStore | llama-index-vector-stores-chroma |
from llama_index.llms import Ollama | from llama_index.llms.ollama import Ollama | llama-index-llms-ollama |
from llama_index.node_parser import SentenceSplitter | from llama_index.core.node_parser import SentenceSplitter | llama-index-core |
from llama_index.agent import ReActAgent | from llama_index.core.agent import ReActAgent | llama-index-core |
llamaindex-cli upgrade <folder> (installed with llama-index-core) rewrites the imports of a project with the same map. (unknown location) in the error means llama_index is now a namespace package with nothing at its top level.
What changed after 0.10?
- 0.11.0 (2024-08-22):
ServiceContextraises on use;Settings(from 0.10.1) replaces it.llama_index.core.workflowarrives. - 0.13.0 (2025-07-30):
llama_index.core.query_pipelineand the old agent classes (AgentRunner,ReActAgentWorker,FunctionCallingAgentWorker,StructuredPlannerAgentand more) are gone; usellama_index.core.agent.workflow(FunctionAgentandAgentWorkflowfrom 0.12.12). - 0.14.21 (2026-04-21):
download_loader,llama_index.core.download,llama_datasetandllama_packare gone; install the reader or pack package directly.
How do I read the error?
- Check both packages:
pip show llama-index llama-index-core. From 0.10 the code is in llama-index-core; the llama-index package only pulls it in with a few integrations. - A mixed install (an old llama-index 0.9 next to llama-index-core) makes imports fail in surprising ways. Uninstall both and install one side.
- An integration name (
llama_index.llms.openai,llama_index.vector_stores.chroma) that fails with "No module named" means its package is not installed; the lookup names the package.
How was this read, and how was it checked?
From the Python files of every release's wheel on PyPI (llama-index 0.7.0 to 0.9.48, llama-index-core 0.10.0 to 0.14.26), read by HTTP range requests and parsed with Python's ast module. The git tags were not used for the data: the v0.10.0 tag exports Settings, the published 0.10.0 wheel does not. A module's names are everything it binds at module level and what from .x import * brings in; names that appear only in __all__ without a binding (0.9.0 lists BeautifulSoupWebReader) are not importable and are not counted. Integration packages are not read; their imports come from the upgrade map.
Checks: (1) the top-level names of each part are found as plain text in its __init__.py in every release of their range (37,235 name-and-release pairs) and are not bound on either side (64 edges). (2) A regular expression finds 31,574 definitions in 7,397 file versions; all are among the names read. (3) 14 release checks against the wheels by plain-text search agree:
| Name | Release | Wheel and data |
|---|---|---|
llama_index.VectorStoreIndex | 0.9.48 | has it |
llama_index.VectorStoreIndex | 0.10.0 | does not |
llama_index.core.VectorStoreIndex | 0.10.0 | has it |
llama_index.core.VectorStoreIndex | 0.9.48 | does not |
llama_index.ServiceContext | 0.9.48 | has it |
llama_index.ServiceContext | 0.10.0 | does not |
llama_index.core.Settings | 0.10.1 | has it |
llama_index.core.Settings | 0.10.0 | does not |
llama_index.core.agent.workflow.ReActAgent | 0.13.0 | has it |
llama_index.core.agent.workflow.ReActAgent | 0.12.0 | does not |
llama_index.core.query_pipeline.QueryPipeline | 0.12.0 | has it |
llama_index.core.query_pipeline.QueryPipeline | 0.13.0 | does not |
llama_index.core.download_loader | 0.11.0 | has it |
llama_index.core.download_loader | 0.14.26 | does not |
Limits
- Nothing was installed or run. "Has it" means the import statement resolves in the Python files of the wheel.
- llama-index before 0.7.0 is not covered (0.6 and older had no pure-Python wheel of this layout).
- Integration packages (llama-index-llms-*, -embeddings-*, -vector-stores-*, -readers-*) have their own versions and are not read; for them the page gives the import and the package from the upgrade map.
Questions
How do I fix "cannot import name 'VectorStoreIndex' from 'llama_index'"?
LlamaIndex 0.10.0 (2024-02-10) moved it: from llama_index.core import VectorStoreIndex. The same holds for SimpleDirectoryReader, StorageContext, Document, load_index_from_storage and the rest of the old top level; 0.9.48 is the last release with the old layout. To keep old code unchanged, pin pip install "llama-index<0.10.0".
How do I fix "cannot import name 'OpenAI' from 'llama_index.llms'"?
From 0.10.0 each integration is its own package: pip install llama-index-llms-openai, then from llama_index.llms.openai import OpenAI. Embeddings and vector stores work the same way, for example llama-index-embeddings-openai and llama-index-vector-stores-chroma. The table on this page and the lookup give the package for 708 names.
ServiceContext imports but fails. What replaces it?
From 0.11.0 (2024-08-22) creating a ServiceContext raises "ServiceContext is deprecated. Use llama_index.settings.Settings instead". Set Settings.llm, Settings.embed_model, Settings.chunk_size and so on, or pass the objects to the functions that use them. Settings is in llama_index.core from 0.10.1.
Where did AgentRunner, FunctionCallingAgentWorker and QueryPipeline go?
llama-index-core 0.13.0 (2025-07-30) removed the old agent classes and query pipelines. Agents are workflow-based: llama_index.core.agent.workflow has FunctionAgent, ReActAgent and AgentWorkflow; pipelines are written as workflows (llama_index.core.workflow, from 0.11.0).
Why does "from llama_index.core import download_loader" fail now?
llama-index-core 0.14.21 (2026-04-21) removed download_loader together with llama_index.core.download, llama_dataset and llama_pack. Install the reader package instead, for example pip install llama-index-readers-file.
Sources
- The wheels of llama-index and llama-index-core on PyPI (file names and sha256 in the build notes), which also give the release dates.
- run-llama/llama_index: llama-index-core/llama_index/core/command_line/mappings.json and upgrade.py at v0.14.26; service_context.py at v0.11.0 (the ServiceContext message).
The same data as JSON: llama_index.json, licensed CC BY 4.0.
Related: "cannot import name ... from 'langchain'" · "... from 'openai'" · "... from 'transformers'".