Error Chatbot using llama_index

Please guide me regarding this error?

ImportError: cannot import name 'VectorStoreIndex' from 'llama_index' (unknown 
2024-04-16 08:25:18.902 503 GET /script-health-check ( 5.31ms
────────────────────── Traceback (most recent call last) ───────────────────────
  nner/ in _run_script                                      
  /mount/src/hellow/ in <module>                                       
     1 import streamlit as st                                                   
  ❱  2 from llama_index import VectorStoreIndex, ServiceContext, Document       
     3 from llama_index.llms import OpenAI                                      
     4 import openai                                                            
     5 from llama_index import SimpleDirectoryReader  

Hi @Arslan_Zahid,

Thanks for sharing your question with the community! :balloon: Please update your debugging post to include a code snippet and a link to your app’s public GitHub repo – this will allow the community to help you find an answer as quickly as possible. In the meantime, this post will be tagged as needs-more-info.

Hi @Arslan_Zahid,

This is the right import call:

from llama_index.core import VectorStoreIndex, ServiceContext, Document

Hi @tonykip
Thanks for your reply
The problem was resolved with following changes:

from llama_index.core import VectorStoreIndex, ServiceContext, Document
from llama_index.llms.openai import OpenAI
from llama_index.core import SimpleDirectoryReader

Hi @tonykip

Please find below the link to Github repo

Arzal007/hellow (

Glad it worked! Happy Streamlit-ing!:balloon:

Are you still experiencing any errors?

No. It is working. Thanks for your support.

1 Like


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.