Problem
While running a job using a Python script to load an MLflow model, you encounter the following error message.
Py4JJavaError: An error occurred while calling o422.get.: java.util.NoSuchElementException: None.get
Cause
MLflow has an issue in versions below 2.15.0. It is resolved in 2.15.0 and above.
Solution
Upgrade MLflow to version 2.15.0 or above.
Verify the current MLflow version.
import mlflow
print(mlflow.__version__)
If it’s an older version, or you use a Databricks Runtime version that comes with an older version of MLflow, install the latest version of MLflow in your Databricks cluster.
- Go to your workspace and select the cluster where you want to install the latest version of MLflow.
- Click the Libraries tab and then click Install New.
- In the Install Library dialog box, select PyPI as the library source and enter MLflow in the Package field. Also make sure to check Attach to cluster.
- Click Install to install the latest version of MLflow.