chroma: [Bug]: AttributeError: 'NoneType' object has no attribute 'info'

What happened?

I have a simple class that creates/connects to a persistent Chroma index, along with add and search functions. When I call this class I am get the following error from the duckdb.py library every time:

Exception ignored in: <function PersistentDuckDB.__del__ at 0x7fe22f7f2710>
Traceback (most recent call last):
  File "/home/adam/.local/lib/python3.10/site-packages/chromadb/db/duckdb.py", line 445, in __del__
AttributeError: 'NoneType' object has no attribute 'info'

The traceback seem to point to this line:

    def __del__(self):
>>        logger.info("PersistentDuckDB del, about to run persist")
        self.persist()

The code seems to otherwise execute as expected.

Versions

Chroma v0.3.21, Python 3.10.6, Ubuntu 22.04

Relevant log output

[status] loading config file: /home/adam/Research/machine-learning/fable/fable/../config/fable.conf
Using embedded DuckDB with persistence: data will be stored in: data/fable
No embedding_function provided, using default embedding function: SentenceTransformerEmbeddingFunction
[status] searching for 3 nearest neighbors
[debug] query_str='threat activity' query_embedding=None doc_ids=None top_k=3
[status] found 1 results
found 1 results
Exception ignored in: <function PersistentDuckDB.__del__ at 0x7efb0c38a680>
Traceback (most recent call last):
  File "/home/adam/.local/lib/python3.10/site-packages/chromadb/db/duckdb.py", line 445, in __del__
AttributeError: 'NoneType' object has no attribute 'info'

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (5 by maintainers)

Most upvoted comments

Hi everyone, we have removed the logger from del and do this in a different way

https://github.com/chroma-core/chroma/blob/main/chromadb/db/duckdb.py#L478

sorry for the trouble!

I found out how this error came out. Because I didn’t set chromadb=None. When the program ends, this error is thrown

same error,when i use ipython to run the code ,the error disappeared.

Hey, I am using langchain too, version 0.0.143, tested with chromadb version 0.3.21 and 0.3.20.

I can confirm the above behaviour of HuggingFaceEmbeddings vs OpenAIEmbeddings.

Output error:

Exception ignored in: <function DuckDB.__del__ at 0x7f21d773d790>
Traceback (most recent call last):
  File "/home/.../.venv/lib/python3.8/site-packages/chromadb/db/duckdb.py", line 358, in __del__
AttributeError: 'NoneType' object has no attribute 'info'

and yes, you can avoid that by forcing the deletion of the object, I did do:

try:
    del vectordb
except Exception as e:
    print(e)