Skip to content
← Back to activity

Immutable solution version

cannot import name 'LLM' from 'llama_index.core.llms'

Version 2

Complete solution

Llama Index: cannot import name 'LLM' from 'llama_index.core.llms'. The verified fix is Fix: Collaborator logan-markewich: the v0.10 split into namespaced packages (llama-index-core + integrations) means any remnants of an old 0.9.x install - globally, outside the venv, or pulled in by another dependency - break imports. Use this when you hit the symptoms above in llama_index; not for unrelated llama_index errors or general setup questions.

TL;DR

Fix: Collaborator logan-markewich: the v0.10 split into namespaced packages (llama-index-core + integrations) means any remnants of an old 0.9.x install - globally, outside the venv, or pulled in by another dependency - break imports. Fix in a fresh terminal: pip uninstall llama-index (remove any global install), create a fresh venv, pip install llama-index --upgrade --no-cache-dir --force-reinstall.

The error

Issue run-llama/llama_index#11302 (closed, 23 comments): ### Bug Description When trying to import via ``` from llama_index.core.indices import VectorStoreIndex from llama_index.core.readers import SimpleDirectoryReader from llama_index.core.storage import StorageContext ``` ### Version 0.10.11 ### Steps to Reproduce install llama index in a new venv with poetry. I delted both `.venv` and `poetry.lock` - the error persists. ### Relevant Logs/Tracbacks ```shell ImportError Traceback (most recent call last) Cell In[8], line 1 ----> 1 from llama_index.core.indices import VectorStoreIndex 2 from llama_index.core.readers import SimpleDirectoryReader 3 fr

Fix

  1. Collaborator logan-markewich: the v0.10 split into namespaced packages (llama-index-core + integrations) means any remnants of an old 0.9.x install - globally, outside the venv, or pulled in by another dependency - break imports.
  2. Fix in a fresh terminal: pip uninstall llama-index (remove any global install), create a fresh venv, pip install llama-index --upgrade --no-cache-dir --force-reinstall.

Success check: the symptom above is gone and the original operation completes.

When to use

  • You hit this exact symptom in llama_index.
  • You want the verified fix without digging through the thread.

When not to use

  • A different error in llama_index, even a similar-looking one.
  • General llama_index setup or credential questions.

Compatibility

  • Llama Index (run-llama/llama_index) Reported against version 0.10.11.

Variant phrasings

  • How to fix "cannot import name 'LLM' from 'llamaindex.core.llms'" in llamaindex
  • llamaindex: cannot import name 'LLM' from 'llamaindex.core.llms'

Source

  • https://github.com/run-llama/llama_index/issues/11302

Evidence

In gh:run-llama/llamaindex#11302 (https://github.com/run-llama/llamaindex/issues/11302), someone reported: Issue run-llama/llamaindex#11302 (closed, 23 comments): ### Bug Description When trying to import via ``` from llamaindex.core.indices import VectorStoreIndex from llamaindex.core.readers import SimpleDirectoryReader from llamaindex.core.storage import StorageContext `` ### Version 0.10.11 ### Steps to Reproduce install llama index in a new venv with poetry. I delted both .venv and poetry.lock - the error persists. ### Relevant Logs/Tracbacks ``shell ImportError Traceback (most recent call last) Cell In[8], line 1 ----> 1 from llamaindex.core.indices import VectorStoreIndex 2 from llamaindex.core.readers import SimpleDirectoryReader 3 fr The verified resolution from the thread: Collaborator logan-markewich: the v0.10 split into namespaced packages (llama-index-core + integrations) means any remnants of an old 0.9.x install - globally, outside the venv, or pulled in by another dependency - break imports. Fix in a fresh terminal: pip uninstall llama-index (remove any global install), create a fresh venv, pip install llama-index --upgrade --no-cache-dir --force-reinstall. Reporter lmaddox: also make sure llama-index-core is installed in minimal environments (not just llama-index).

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ZF8xeAHfm34G42z8I4LHJw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">cannot import name &#39;LLM&#39; from &#39;llama_index.core.llms&#39; <span>— Vectle</span></a>

cannot import name 'LLM' from 'llama_index.core.llms' | Vectle