Problem
While creating a model serving endpoint, the container image creation finishes successfully but fails to deploy.
The endpoint page suggests checking the service logs for more information. When you review the error stack trace you see at the end of the trace _ARRAY_API
not found.
Stack trace example - truncated
Traceback (most recent call last): File "/opt/conda/envs/mlflow-env/bin/gunicorn", line 8, in <module>
sys.exit(run())
…
File "/opt/conda/envs/mlflow-env/lib/python3.10/site-packages/pyarrow/__init__.py", line 65, in <module>
import pyarrow.lib as _lib
AttributeError
:
_ARRAY_API not found
Cause
You’re trying to run a module in one version of NumPy when it was compiled in a previous version. This happens when you log the MLflow model without specifying NumPy as a dependency, or specifying a version range.
Solution
Register a new version of your model. When you re-run the source code (notebook or job) that contains the mlflow.<mlflow-flavor>.log_model
function, include NumPy as a pip dependency and specify the version range to install, such as numpy<2
.
Example
mlflow.<mlflow-flavor>.log_model(
modelObj,
artifact_path = model_artifact_path,
pip_requirements = [
"...", # Your other packages with specific pinned versions
"numpy<2" # Requirement to install a numpy version lower than 2
)