Below is my code, can someone please advise on whether something should be in requirements file? I tried using the advice on forum which didnt work:
import pysqlite3
import sys
from langchain_community.vectorstores import Chroma
from langchain_community.chat_message_histories import StreamlitChatMessageHistory
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.runnables.history import RunnableWithMessageHistory
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from langchain.chains import create_history_aware_retriever, create_retrieval_chain
from langchain.chains.combine_documents import create_stuff_documents_chain
Iβm running into the same as @amritg . Iβve attempted more than 20 redeployments following the instructions in the suggested troubleshooting chromadb docs without successβ¦ Hereβs another issue from the crewai community that may be useful. Iβm at a loss, because I donβt run into this issue in my local environment, and iβve replicated exactly all the dependencies in a fresh virtual env to see what could be wrongβ¦ Any tips or advice would be greatly appreciated.
For reference, hereβs my traceback + error:
2024-08-29 20:14:15,982 [embedchain] [ERROR] Failed to swap std-lib sqlite3 with pysqlite3 for ChromaDb compatibility. Error: Command '['/home/adminuser/venv/bin/python', '-m', 'pip', 'install', 'pysqlite3-binary', '--quiet', '--disable-pip-version-check']' returned non-zero exit status 1.
ββββββββββββββββββββββ Traceback (most recent call last) βββββββββββββββββββββββ
/home/adminuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptru
nner/exec_code.py:88 in exec_func_with_error_handling
/home/adminuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptru
nner/script_runner.py:590 in code_to_exec
/mount/src/aibstracts-librarian/main.py:1001 in <module>
998
999
1000 if __name__ == "__main__":
β± 1001 β main()
1002
/mount/src/aibstracts-librarian/main.py:818 in main
815 β β β β β β if item.get('role') in ['user', 'academic ass
816 β β β β β ]
817 β β β β β
β± 818 β β β β β agent_result = academic_engine.talk_to_academai_a
819 β β β β β
820 β β β β β
821 β β β β β #### IMPORTANT to remember
/mount/src/aibstracts-librarian/academic_engine.py:2044 in
talk_to_academai_assistant
2041 β β print("Error during transforming papers:", e)
2042
2043 def talk_to_academai_assistant(user_prompt: str, recent_conversation)
β± 2044 β from crewai import Agent, Task, Crew, Process
2045 β from crewai_tools import tool
2046 β # from crewai.tasks.task_output import TaskOutput
2047 β from langchain_google_genai import ChatGoogleGenerativeAI
/home/adminuser/venv/lib/python3.10/site-packages/crewai/__init__.py:1 in
<module>
β± 1 from crewai.agent import Agent
2 from crewai.crew import Crew
3 from crewai.pipeline import Pipeline
4 from crewai.process import Process
/home/adminuser/venv/lib/python3.10/site-packages/crewai/agent.py:13 in
<module>
10 from langchain_openai import ChatOpenAI
11 from pydantic import Field, InstanceOf, PrivateAttr, model_validator
12
β± 13 from crewai.agents import CacheHandler, CrewAgentExecutor, CrewAgentPa
14 from crewai.agents.agent_builder.base_agent import BaseAgent
15 from crewai.memory.contextual.contextual_memory import ContextualMemor
16 from crewai.tools.agent_tools import AgentTools
/home/adminuser/venv/lib/python3.10/site-packages/crewai/agents/__init__.py:
2 in <module>
1 from .cache.cache_handler import CacheHandler
β± 2 from .executor import CrewAgentExecutor
3 from .parser import CrewAgentParser
4 from .tools_handler import ToolsHandler
5
/home/adminuser/venv/lib/python3.10/site-packages/crewai/agents/executor.py:
19 in <module>
16 from langchain.text_splitter import RecursiveCharacterTextSplitter
17 from langchain.chains.summarize import load_summarize_chain
18
β± 19 from crewai.agents.agent_builder.base_agent_executor_mixin import Crew
20 from crewai.agents.tools_handler import ToolsHandler
21
22
/home/adminuser/venv/lib/python3.10/site-packages/crewai/agents/agent_builde
r/base_agent_executor_mixin.py:4 in <module>
1 import time
2 from typing import TYPE_CHECKING, Optional
3
β± 4 from crewai.memory.entity.entity_memory_item import EntityMemoryItem
5 from crewai.memory.long_term.long_term_memory_item import LongTermMemo
6 from crewai.utilities.converter import ConverterError
7 from crewai.utilities.evaluators.task_evaluator import TaskEvaluator
/home/adminuser/venv/lib/python3.10/site-packages/crewai/memory/__init__.py:
1 in <module>
β± 1 from .entity.entity_memory import EntityMemory
2 from .long_term.long_term_memory import LongTermMemory
3 from .short_term.short_term_memory import ShortTermMemory
4
/home/adminuser/venv/lib/python3.10/site-packages/crewai/memory/entity/entit
y_memory.py:3 in <module>
1 from crewai.memory.entity.entity_memory_item import EntityMemoryItem
2 from crewai.memory.memory import Memory
β± 3 from crewai.memory.storage.rag_storage import RAGStorage
4
5
6 class EntityMemory(Memory):
/home/adminuser/venv/lib/python3.10/site-packages/crewai/memory/storage/rag_
storage.py:10 in <module>
7
8 from crewai.memory.storage.interface import Storage
9 from crewai.utilities.paths import db_storage_path
β± 10 from embedchain import App
11 from embedchain.llm.base import BaseLlm
12 from embedchain.models.data_type import DataType
13 from embedchain.vectordb.chroma import InvalidDimensionException
/home/adminuser/venv/lib/python3.10/site-packages/embedchain/__init__.py:5
in <module>
2
3 __version__ = importlib.metadata.version(__package__ or __name__)
4
β± 5 from embedchain.app import App # noqa: F401
6 from embedchain.client import Client # noqa: F401
7 from embedchain.pipeline import Pipeline # noqa: F401
8
/home/adminuser/venv/lib/python3.10/site-packages/embedchain/app.py:38 in
<module>
35 from embedchain.utils.evaluation import EvalData, EvalMetric
36 from embedchain.utils.misc import validate_config
37 from embedchain.vectordb.base import BaseVectorDB
β± 38 from embedchain.vectordb.chroma import ChromaDB
39
40 logger = logging.getLogger(__name__)
41
/home/adminuser/venv/lib/python3.10/site-packages/embedchain/vectordb/chroma
.py:4 in <module>
1 import logging
2 from typing import Any, Optional, Union
3
β± 4 from chromadb import Collection, QueryResult
5 from langchain.docstore.document import Document
6 from tqdm import tqdm
7
/home/adminuser/venv/lib/python3.10/site-packages/chromadb/__init__.py:79 in
<module>
76 β β β __import__("pysqlite3")
77 β β β sys.modules["sqlite3"] = sys.modules.pop("pysqlite3")
78 β β else:
β± 79 β β β raise RuntimeError(
80 β β β β "\033[91mYour system has an unsupported version of sql
81 β β β β β requires sqlite3 >= 3.35.0.\033[0m\n"
82 β β β β "\033[94mPlease visit \
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
RuntimeError: e[91mYour system has an unsupported version of sqlite3. Chroma
requires sqlite3 >= 3.35.0.e[0m
e[94mPlease visit
https://docs.trychroma.com/troubleshooting#sqlite to learn how
to upgrade.e[0m
Follow these straightforward steps to resolve your SQLite version error encountered while deploying on Streamlit Cloud:
Corrective Actions:
A simple solution is to modify your requirements.txt file by adding pysqlite3-binary. This adjustment ensures your application operates with the necessary version. Just include this line in your requirements.txt:
pysqlite3-binary
After making this change, if you are using sqlite3 directly somewhere then update your code. Replace:
import sqlite3
with:
import pysqlite3 as sqlite3
Lastly if the error is being caused due to a dependency of any class on sqlite3 then make sure to add the below lines above the lines causing error. As a matter of fact, it is simply better to add it at the top of the python file where there error is being caused:
Finally, redeploy your application to refresh your project with the updated dependencies. This allows ChromaDB to function as expected. Hope it solves this issue. Enjoy your app streamlit cloud.
Fun Fact: I tackled this error while trying to deploy my Ai Writing Agent Crew on streamlit and hence it was only justified to generate this comment with my writing agent crew. Cheers to all the dev out there !!!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking βAccept allβ, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.