Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I previously deployed an app on Streamlit Cloud that utilized chromadb.

The app worked fine in the past. However, today I encountered a new error (as indicated in the title) and the app has stopped functioning.

I attempted to troubleshoot based on solutions from the Streamlit forum and performed the following steps sequentially:

  1. Updated the requirements.txt file by adding pysqlite3-binary.
  2. Added the following three lines of code at the top of app.py:
__import__('pysqlite3')
import sys

sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')

After rebooting my app, I discovered the new error:

ModuleNotFoundError: No module named 'pysqlite3'
Traceback:
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
File "/mount/src/docgpt-streamlit/app.py", line 2, in <module>
    import pysqlite3

Subsequently, I tried adding pysqlite3 again to requirements.txt, but the error persisted.

According to the logs from manage app, I observed that Streamlit did not perform a re-pip install action.

enter image description here

Could this be causing the pysqlite error? If so, how can I correctly enable the Streamlit app to automatically pip install due to my updated requirements.txt?

like image 647
Xiang Avatar asked Sep 11 '25 23:09

Xiang


1 Answers

I did this and it worked for me:

  1. Install pysqlite3-binary using: pip3 install pysqlite3-binary
  2. Then add below 3 lines in your code file where you have defined Chromadb

Credits: I got this answer from here: Issues with chroma and sqlite

Note: Doesn't matter if you are using django, flask or fastapi. It should work regardless.

__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
like image 158
pintz Avatar answered Sep 13 '25 11:09

pintz