[
https://issues.apache.org/jira/browse/NIFI-13628?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Zsihovszki Krisztina updated NIFI-13628:
----------------------------------------
Description:
PutChroma processor did not start due to the following error:
{code:java}
File "/opt/nifi/nifi-current/python/extensions/vectorstores/ChromaUtils.py",
line 125, in create_client
import chromadb
File
"/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/chromadb/{}init{}.py",
line 3, in <module>
from chromadb.api.client import Client as ClientCreator
File
"/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/chromadb/api/{}init{}.py",
line 7, in <module>
from chromadb.api.models.Collection import Collection
File
"/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/chromadb/api/models/Collection.py",
line 7, in <module>
import chromadb.utils.embedding_functions as ef
File
"/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/chromadb/utils/embedding_functions.py",
line 6, in <module>
from chromadb.api.types import (
File
"/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/chromadb/api/types.py",
line 101, in <module>
ImageDType = Union[np.uint, np.int_, np.float_]
File
"/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/numpy/{}init{}.py",
line 397, in _getattr_
raise AttributeError(
AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use
`np.float64` instead.{code}
The error is related to NumPy 2.0 and chromadb incompatibility:
[https://github.com/vanna-ai/vanna/discussions/501]
The ChromaDB lib requires NumPy version greater than 1.22.5. Since NumPy 2.0
was released (Jun 2024), sometimes PutChroma processors pick NumPy 2.0 version
and fail due to the "np.float_" issue.
This issue can not be always reproduced. In most of the cases the numpy-1.26.4
is used (which version is fixed for ParseDocument.py) but there are cases when
the 2.0 version is used.
The recommended solution for NumPy 2.0 incompatibility is to force using NumPy
1.26.4.
was:
PutChroma processor did not start when I used the Python class from
nifi-python-extensions repo for the first time.
The following error was reported:
{code:java}
File
".../repositories/nifi/nifi-assembly/target/nifi-2.0.0-SNAPSHOT-bin/nifi-2.0.0-SNAPSHOT/./python/framework/Controller.py",
line 71, in createProcessor
processor = processorClass(jvm=self.gateway.jvm)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: PutChroma.__init__() got an unexpected keyword argument 'jvm'{code}
I noticed that **kwargs was deleted from PutChroma._{_}init{_}_() when the
processor was moved to the new repo.
The reason for removal might have been the linter which marks **kwargs as
unused.
_ARG002 Unused method argument: `kwargs`_
Although Contoller.py on NiFi side would like to pass self.gateway.jvm in the
constructor.
When I put back **kwargs, the processor started as usual.
A solution can be to put back **kwargs and supress the linter warning.
> Using NumPy 2.0 breaks ChromaDB processors
> ------------------------------------------
>
> Key: NIFI-13628
> URL: https://issues.apache.org/jira/browse/NIFI-13628
> Project: Apache NiFi
> Issue Type: Bug
> Reporter: Zsihovszki Krisztina
> Assignee: Zsihovszki Krisztina
> Priority: Major
> Fix For: python-extensions-2.0.0
>
>
> PutChroma processor did not start due to the following error:
> {code:java}
> File "/opt/nifi/nifi-current/python/extensions/vectorstores/ChromaUtils.py",
> line 125, in create_client
> import chromadb
> File
> "/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/chromadb/{}init{}.py",
> line 3, in <module>
> from chromadb.api.client import Client as ClientCreator
> File
> "/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/chromadb/api/{}init{}.py",
> line 7, in <module>
> from chromadb.api.models.Collection import Collection
> File
> "/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/chromadb/api/models/Collection.py",
> line 7, in <module>
> import chromadb.utils.embedding_functions as ef
> File
> "/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/chromadb/utils/embedding_functions.py",
> line 6, in <module>
> from chromadb.api.types import (
> File
> "/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/chromadb/api/types.py",
> line 101, in <module>
> ImageDType = Union[np.uint, np.int_, np.float_]
> File
> "/opt/nifi/nifi-current/./work/python/extensions/PutChroma/2.0.0.x.y.z/numpy/{}init{}.py",
> line 397, in _getattr_
> raise AttributeError(
> AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use
> `np.float64` instead.{code}
> The error is related to NumPy 2.0 and chromadb incompatibility:
> [https://github.com/vanna-ai/vanna/discussions/501]
> The ChromaDB lib requires NumPy version greater than 1.22.5. Since NumPy 2.0
> was released (Jun 2024), sometimes PutChroma processors pick NumPy 2.0
> version and fail due to the "np.float_" issue.
> This issue can not be always reproduced. In most of the cases the
> numpy-1.26.4 is used (which version is fixed for ParseDocument.py) but there
> are cases when the 2.0 version is used.
> The recommended solution for NumPy 2.0 incompatibility is to force using
> NumPy 1.26.4.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)