chroma icon indicating copy to clipboard operation
chroma copied to clipboard

[Bug]: sqlite3.OperationalError: no such column: collections.topic

Open pseudotensor opened this issue 1 year ago • 5 comments

What happened?


  File "/home/tomershm/h2ogpt/src/gpt_langchain.py", line 4519, in get_existing_db
    db = chroma_class(persist_directory=persist_directory, embedding_function=embedding,
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/langchain_community/vectorstores/chroma.py", line 126, in __init__
    self._collection = self._client.get_or_create_collection(
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/api/client.py", line 237, in get_or_create_collection
    return self._server.get_or_create_collection(
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 127, in wrapper
    return f(*args, **kwargs)
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/api/segment.py", line 217, in get_or_create_collection
    return self.create_collection(  # type: ignore
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 127, in wrapper
    return f(*args, **kwargs)
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/api/segment.py", line 167, in create_collection
    coll, created = self._sysdb.create_collection(
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 127, in wrapper
    return f(*args, **kwargs)
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/db/mixins/sysdb.py", line 209, in create_collection
    existing = self.get_collections(name=name, tenant=tenant, database=database)
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 127, in wrapper
    return f(*args, **kwargs)
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/db/mixins/sysdb.py", line 435, in get_collections
    rows = cur.execute(sql, params).fetchall()
sqlite3.OperationalError: no such column: collections.topic

Versions

chroma 0.4.23 python 3.10.

A user of h2oGPT hit this, unsure why. Any ideas?

Relevant log output

No response

pseudotensor avatar May 06 '24 19:05 pseudotensor

I've also encountered this issue today when running a a script that worked the week before last.

I did some looking around at commits and I think I found the problem. The third party tool you are using is likely using an older version of chroma (something like 0.4.x) because the topic column was removed in the latest version of chroma 0.5.0 (see https://github.com/chroma-core/chroma/pull/1933)

So if you have a version mismatch (say a new instance of chromadb and an older script/tool using it) you will get this error

MathiasToftas avatar May 07 '24 14:05 MathiasToftas

@pseudotensor, in 0.4.24, we phased out a column in the SQLite DB. The change is not backward compatible for clients. That means that if you have a DB created or accessed with 0.4.24, we apply a migration to the chroma.sqlite3 file, which is non-reversible, and any older client will give you the above exception.

tazarov avatar May 07 '24 16:05 tazarov

I think this is due to a version mismatch with 0.5. Can you confirm if that solves your issue ?

HammadB avatar May 09 '24 18:05 HammadB

switching to 0.5 solves the issue

UPDATE: now I am facing this error when using collection.query

chromadb Exception: {"error":"AttributeError(\"type object 'QueryEmbedding' has no attribute 'model_validate'\")"}

aliyassine26 avatar May 13 '24 13:05 aliyassine26

@aliyassine26, this is due to an older version of pydantic. Can you bump your pydantic version to 2.x+

tazarov avatar May 14 '24 18:05 tazarov

I have a Chroma version: 0.4.22 , SQLite version: 3.42.0 , Python 3.11.9 still getting the issue Exception has occurred: OperationalError no such column: collections.topic File "C:\Users\SayantaniGhosh\Documents\IBM24\GenAI_WatsonX_Usecase_DIAGEO\git_repo\test_bpmn_fiori\services\test1.py", line 34, in fetch_all_docs db3 = Chroma(persist_directory="./db_manager/chroma_db_impact", embedding_function=embeddings1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\SayantaniGhosh\Documents\IBM24\GenAI_WatsonX_Usecase_DIAGEO\git_repo\test_bpmn_fiori\services\test1.py", line 54, in extracted_details_for_fiori_app = fetch_all_docs(fiori_app_names_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: no such column: collections.topic

Sayantanighosh17github avatar May 18 '24 21:05 Sayantanighosh17github

@Sayantanighosh17github, this issue appears when you have accessed your Chroma persistent data with 0.5.0 version. Chroma does a schema migration from 0.4.x->0.5.x. To resolve start using Chroma 0.5.0.

tazarov avatar May 19 '24 05:05 tazarov

Thanks you guys so much!

Princekrampah avatar Aug 24 '24 12:08 Princekrampah