private-gpt icon indicating copy to clipboard operation
private-gpt copied to clipboard

chromadb.errors.NoIndexException: Index not found, please create an instance before querying`

Open sreekanthtn opened this issue 1 year ago • 22 comments

llama_print_timings: eval time = 0.00 ms / 1 runs ( 0.00 ms per run)

llama_print_timings: total time = 372.25 ms Traceback (most recent call last): File "/media/sreekanth/Data/PrivateGPT/privateGPT.py", line 59, in main() File "/media/sreekanth/Data/PrivateGPT/privateGPT.py", line 44, in main res = qa(query)
File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 140, in call raise e File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 134, in call self._call(inputs, run_manager=run_manager) File "/usr/local/lib/python3.10/dist-packages/langchain/chains/retrieval_qa/base.py", line 119, in _call docs = self._get_docs(question) File "/usr/local/lib/python3.10/dist-packages/langchain/chains/retrieval_qa/base.py", line 181, in _get_docs return self.retriever.get_relevant_documents(question) File "/usr/local/lib/python3.10/dist-packages/langchain/vectorstores/base.py", line 366, in get_relevant_documents docs = self.vectorstore.similarity_search(query, **self.search_kwargs) File "/usr/local/lib/python3.10/dist-packages/langchain/vectorstores/chroma.py", line 181, in similarity_search docs_and_scores = self.similarity_search_with_score(query, k, filter=filter) File "/usr/local/lib/python3.10/dist-packages/langchain/vectorstores/chroma.py", line 228, in similarity_search_with_score results = self.__query_collection( File "/usr/local/lib/python3.10/dist-packages/langchain/utils.py", line 50, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/langchain/vectorstores/chroma.py", line 120, in __query_collection return self._collection.query( File "/usr/local/lib/python3.10/dist-packages/chromadb/api/models/Collection.py", line 219, in query return self._client._query( File "/usr/local/lib/python3.10/dist-packages/chromadb/api/local.py", line 408, in _query uuids, distances = self._db.get_nearest_neighbors( File "/usr/local/lib/python3.10/dist-packages/chromadb/db/clickhouse.py", line 583, in get_nearest_neighbors uuids, distances = index.get_nearest_neighbors(embeddings, n_results, ids) File "/usr/local/lib/python3.10/dist-packages/chromadb/db/index/hnswlib.py", line 230, in get_nearest_neighbors raise NoIndexException( chromadb.errors.NoIndexException: Index not found, please create an instance before querying``

sreekanthtn avatar May 14 '23 17:05 sreekanthtn

Same issue.

JaccoVeldscholten avatar May 14 '23 21:05 JaccoVeldscholten

same issue +1

sivanbil avatar May 14 '23 22:05 sivanbil

Same issue.

virtualramblas avatar May 14 '23 23:05 virtualramblas

same issue +1

wxsimon-stu avatar May 15 '23 02:05 wxsimon-stu

try python ingest.py first, this should ingest the state of the union text and create an index.

cloudmation avatar May 15 '23 04:05 cloudmation

already run ingest.py and created the collections and embedding files in db folder.still getting this issue

sreekanthtn avatar May 15 '23 07:05 sreekanthtn

already run ingest.py and same issue too 😀

hsm207 avatar May 15 '23 12:05 hsm207

same issue

imfurkaann avatar May 15 '23 13:05 imfurkaann

same

Insel-Ding avatar May 15 '23 15:05 Insel-Ding

Same error

Here you have more context - https://gist.github.com/pancutan/8d95dbe52bf3173077a40695d1271b14

pancutan avatar May 16 '23 00:05 pancutan

When developing LangChain integration for h2oGPT, I ran across this and other issues mentioned in this repo. One reason is because the chroma db was named differently when created vs. read later.

Try out h2oGPT if you like: https://github.com/h2oai/h2ogpt -- should be more stable w.r.t. these kind of issues.

pseudotensor avatar May 16 '23 07:05 pseudotensor

@pseudotensor is it also possible to set up h2ogpt the same as privateGPT i.e. do document QnA locally without having any data leave the local machine?

hsm207 avatar May 16 '23 09:05 hsm207

Same issue here

sleepstate avatar May 16 '23 09:05 sleepstate

@pseudotensor is it also possible to set up h2ogpt the same as privateGPT i.e. do document QnA locally without having any data leave the local machine?

Yes.

pseudotensor avatar May 16 '23 18:05 pseudotensor

+1

digitalw00t avatar May 17 '23 02:05 digitalw00t

Same issue here

prestaino avatar May 17 '23 07:05 prestaino

In case anyone is blocked by this, I made a fork to add support for weavite as the vector store. Configuring the project to use weaviate works! Instructions to do this are in the docs .

demo-privategpt

hsm207 avatar May 17 '23 12:05 hsm207

System: Linux / NVIDIA GTX 1660 Error Message Traceback (most recent call last): File "/home/user/privateGPT/privateGPT.py", line 57, in main() File "/home/user/privateGPT/privateGPT.py", line 42, in main res = qa(query)
^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/langchain/chains/base.py", line 140, in call raise e File "/home/user/.local/lib/python3.11/site-packages/langchain/chains/base.py", line 134, in call self._call(inputs, run_manager=run_manager) File "/home/user/.local/lib/python3.11/site-packages/langchain/chains/retrieval_qa/base.py", line 119, in _call docs = self._get_docs(question) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/langchain/chains/retrieval_qa/base.py", line 181, in _get_docs return self.retriever.get_relevant_documents(question) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/langchain/vectorstores/base.py", line 366, in get_relevant_documents docs = self.vectorstore.similarity_search(query, **self.search_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/langchain/vectorstores/chroma.py", line 181, in similarity_search docs_and_scores = self.similarity_search_with_score(query, k, filter=filter) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/langchain/vectorstores/chroma.py", line 228, in similarity_search_with_score results = self.__query_collection( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/langchain/utils.py", line 50, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/langchain/vectorstores/chroma.py", line 120, in __query_collection return self._collection.query( ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/chromadb/api/models/Collection.py", line 219, in query return self._client._query( ^^^^^^^^^^^^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/chromadb/api/local.py", line 408, in _query uuids, distances = self._db.get_nearest_neighbors( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/chromadb/db/clickhouse.py", line 583, in get_nearest_neighbors uuids, distances = index.get_nearest_neighbors(embeddings, n_results, ids) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/.local/lib/python3.11/site-packages/chromadb/db/index/hnswlib.py", line 230, in get_nearest_neighbors raise NoIndexException( chromadb.errors.NoIndexException: Index not found, please create an instance before querying

MichaelSebero avatar May 17 '23 23:05 MichaelSebero

Visit the chroma-core git warehouse and find a solution in readme

sivanbil avatar May 18 '23 01:05 sivanbil

https://github.com/hwchase17/langchain/issues/3011

This seems related.

PulpCattel avatar May 18 '23 12:05 PulpCattel

Had the same issue which I fixed by running the ingestion first:

python ingest.py

This creates a db/index/ folder.

samsonradu avatar May 19 '23 15:05 samsonradu

Same issue

gustavofelicidade avatar May 19 '23 16:05 gustavofelicidade

This the way I solved it : change the SOURCE_DIRECTORY and PERSIST_DIRECTORY in constants.py correct, and run "python3 ingest.py", after that there is a index in DB directory. And then problem solved.

xxiexueyan avatar Jul 11 '23 09:07 xxiexueyan