No module named 'gpt_index'


I have already added “gpt-index” in the requirements file, but met the module not found error. The tricky thing is that, the module name is “gpt-index” when pip install gpt-index, but the name is “gpt_index” when import it. I 'm not sure it’s because of “-” and “_” in the different names . how to solve this problem? thanks so much.
below is the github code
Share a clear and concise description of the issue. Aim for 2-3 sentences.

Steps to reproduce

Code snippet:

add code here

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.


  • Link to your GitHub repo:
  • Link to your deployed app:

Additional information

If needed, add any other context about the problem here.

There is a lot of confusion in this fast developing LLM ecosystem, because the naming and APIs are changing all the time. Therefore always read the latest documentaion carefully! And sometimes even the docs does not keep up with the implementation… :neutral_face:

AFAIK you have to use:

import llama_index

The pip install will work with both of the following package names:

pip install gpt-index


pip install gpt_index

…will both do the same.

thanks so much! llama-index==0.6.0a6 and import llama_index works.

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