chroma-core / chroma

the AI-native open-source embedding database
https://www.trychroma.com/
Apache License 2.0
13.36k stars 1.14k forks source link

[Bug]: Attritube Error due to NumPy2.0. release. #2418

Open startakovsky opened 3 days ago

startakovsky commented 3 days ago

What happened?

This issue occurs when import chromadb and having NumPy 2.0 installed.

Related issue: https://github.com/chroma-core/chroma/issues/2407

AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.. Did you mean: 'float16'?
>>> np.float16
<class 'numpy.float16'>

Versions

Chromadb 0.5.2

Relevant log output

No response

Prashantsaini25 commented 3 days ago

from llama_index.vectorstores.chroma import ChromaVectorStore still have same issue AttributeError: `np.floatwas removed in the NumPy 2.0 release. Usenp.float64` instead.

Traceback: File "/usr/local/lib/python3.10/dist-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script exec(code, module.dict) File "/app/streamlit_app.py", line 10, in from llama_index.vector_stores.chroma import ChromaVectorStore File "/usr/local/lib/python3.10/dist-packages/llama_index/vector_stores/chroma/init.py", line 1, in from llama_index.vector_stores.chroma.base import ChromaVectorStore File "/usr/local/lib/python3.10/dist-packages/llama_index/vector_stores/chroma/base.py", line 7, in import chromadb File "/usr/local/lib/python3.10/dist-packages/chromadb/init.py", line 3, in from chromadb.api.client import Client as ClientCreator File "/usr/local/lib/python3.10/dist-packages/chromadb/api/init.py", line 7, in from chromadb.api.models.Collection import Collection File "/usr/local/lib/python3.10/dist-packages/chromadb/api/models/Collection.py", line 4, in from chromadb.api.models.CollectionCommon import CollectionCommon File "/usr/local/lib/python3.10/dist-packages/chromadb/api/models/CollectionCommon.py", line 14, in import chromadb.utils.embedding_functions as ef File "/usr/local/lib/python3.10/dist-packages/chromadb/utils/embeddingfunctions.py", line 7, in from chromadb.api.types import ( File "/usr/local/lib/python3.10/dist-packages/chromadb/api/types.py", line 104, in ImageDType = Union[np.uint, np.int, np.float_] File "/usr/local/lib/python3.10/dist-packages/numpy/init.py", line 397, in getattr raise AttributeError(

llama-index-vector-stores-chroma => 0.1.9
chromadb = 0.5.3
adlternative commented 3 days ago

Rollback numpy to 1.26.4 work for me.

chromadb (0.4.24)

 conda install numpy=1.26.4
tazarov commented 2 days ago

@startakovsky, we've made a deliberate choice of pinning the version of numpy we use to <2.0 in the latest Chroma release (0.5.3).

@Prashantsaini25, we'll have a look at llama-index-vector-stores-chroma and we'll bump Chroma version to 0.5.3 there too. I can see that even LlamaIndex have not yet adopted numpy2 https://github.com/run-llama/llama_index/blob/663e1700f58c2414e549b9f5005abe87a275dd77/llama-index-core/pyproject.toml#L56