chroma icon indicating copy to clipboard operation
chroma copied to clipboard

duckdb.IOException: IO Error: Can't find the home directory at ''

Open harry0703 opened this issue 1 year ago • 3 comments

client = chromadb.Client(Settings(
            chroma_db_impl="duckdb+parquet",
            persist_directory="/home/chromadb"
        ))

if i start the app with supervisorctl, there is an error:

File "/usr/local/lib/python3.8/site-packages/chromadb/db/duckdb.py", line 50, in __init__
    self._conn.execute("INSTALL 'json';")
duckdb.IOException: IO Error: Can't find the home directory at ''
Specify a home directory using the SET home_directory='/path/to/dir' option.
Exception ignored in: <function PersistentDuckDB.__del__ at 0x7f467e032790>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/chromadb/db/duckdb.py", line 436, in __del__
    self.persist()
  File "/usr/local/lib/python3.8/site-packages/chromadb/db/duckdb.py", line 390, in persist
    self._conn.execute(
duckdb.IOException: IO Error: Cannot open file "None/chroma-embeddings.parquet": No such file or directory

harry0703 avatar Mar 26 '23 06:03 harry0703

@harry0703 does the home directory already exist on your machine?

jeffchuber avatar Mar 26 '23 23:03 jeffchuber

@harry0703 does the home directory already exist on your machine? thank you for your reply.

yes, the home directory is exist.

If i run the app in working dir, it works well.

cd /home/www/chatbot
nohup /usr/local/bin/uvicorn --host 0.0.0.0 main:app --port 4003 --workers 1  > /var/log/supervisor/chatbot.log 2>&1 &

but it doesn't work in supervisord

[program:chatbot]
process_name=chatbot
directory=/home/www/chatbot
command=/usr/local/bin/uvicorn --host 0.0.0.0 main:app --port 4003 --workers 1 
numprocs=1
user=root
autostart=true
autorestart=true
redirect_stderr=true
stopasgroup=true
killasgroup=true
stopsignal=INT
stdout_logfile=/var/log/supervisor/chatbot.log

below is my python code:


class ChromaUtils:
    def __init__(self, persist_directory: str = 'chromadb', embedding_function: Callable = None):
        # os.putenv('home_directory', persist_directory)
        # #   duckdb.IOException: IO Error: Can't find the home directory at ''
        # #   Specify a home directory using the SET home_directory='/path/to/dir' option.
        # os.environ['home_directory'] = persist_directory

        self._collection_name_posts = 'posts'
        self._collection_name_prompts = 'prompts'

        self.client = chromadb.Client(Settings(
            chroma_db_impl="duckdb+parquet",
            persist_directory=persist_directory  # Optional, defaults to .chromadb/ in the current directory
        ))

        self.collection_posts = self.client.get_or_create_collection(name=self._collection_name_posts, embedding_function=embedding_function)
        self.collection_prompts = self.client.get_or_create_collection(name=self._collection_name_prompts, embedding_function=embedding_function)

harry0703 avatar Mar 29 '23 01:03 harry0703

i'm having the same issue

jerikoXD avatar Apr 09 '23 22:04 jerikoXD

With the launch of Chroma 0.4 - duckdb is no longer a dependency and this should be fixed!

jeffchuber avatar Jul 27 '23 18:07 jeffchuber