Chromadb + Langchain with SentenceTransformerEmbeddingFunction throwing sqlite3 >= 3.35.0 error, despite sqlite3 3.43.0 being available
Asked Answered
T

1

5

I have been trying to use

  • Chromadb version 0.4.8
  • Langchain version 0.0.276

with SentenceTransformerEmbeddingFunction as shown in the snippet below.

from langchain.vectorstores import Chroma
from chromadb.utils import embedding_functions

# other imports
embedding = embedding_functions.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2")

However, it throws the following error.

RuntimeError: Your system has an unsupported version of sqlite3. Chroma requires sqlite3 >= 3.35.0.

Funfact is I do have the required sqlite3 (3.43.0) available which I can validate using the command sqlite3 --version.

Would appreciate any help. Thank you.

Tachylyte answered 30/8, 2023 at 3:41 Comment(2)
refer this docs.trychroma.com/troubleshooting#sqliteBragi
I have the same problem. I get the error about the unsuported version of sqlite3 even if I have a version which should be supported (like the OP) and also when I do not have sqlite3 installed at all. @ZKS' link (which is also in the complete error message) gives several ways to get a supported sqlite3 version, but I am not sure this is actually the problem.Paynter
P
8

The error message results from importing chromadb in Python:

>>> import chromadb
[...]
RuntimeError: Your system has an unsupported version of sqlite3. Chroma requires sqlite3 >= 3.35.0.
Please visit https://docs.trychroma.com/troubleshooting#sqlite to learn how to upgrade.

A workaround is suggested through the above url and the informative source code of Chroma. First

$ pip install pysqlite3-binary 

Then, in Python:

>>> import pysqlite3
>>> import sys
>>> sys.modules["sqlite3"] = sys.modules.pop("pysqlite3")
>>> import chromadb
>>>

which should now not produce any errors.

Fun fact:

$ sqlite3 --version
3.31.1 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837balt1

while at the same time, continuing at the above Python console:

>>> import sqlite3
>>> sqlite3.sqlite_version
'3.43.1'
Paynter answered 6/10, 2023 at 14:53 Comment(2)
Is there a particular version of python required. I tried python 3.8.6 and 3.8.10 and neither can see pysqlite3-binaryPilkington
@elbillaf, I'm using Python 3.8.10 right now, but if I remember well, it worked for several versions. Are you getting an error when pip installing pysqlite3-binary? What error?Paynter

© 2022 - 2024 — McMap. All rights reserved.