5
votes

I'm trying to load a XBGClassifier model with joblib and pickle.

When using joblib loaded_model = joblib.load('trained_model.sav') I'm getting the following error: AttributeError: module 'xgboost.compat' has no attribute 'XGBoostLabelEncoder'

And with pickle loaded_model = pickle.load(open('trained_model.sav', 'rb')) I get AttributeError: Can't get attribute 'XGBoostLabelEncoder' on <module 'xgboost.compat' from 'C:\Users\Usuario\Anaconda3\lib\site-packages\xgboost\compat.py'>

I installed xgboost again but it doesn't work, what might be the issue?

1
what did you save? what was the command for that? Because something like XGBoostLabelEncoder doesn't exist AFAIK. - N. Kiefer

1 Answers

0
votes

Make sure that the xgboost versions in the saved and loaded environments are the same. You need to change the version of xgboost in the environment that you try to load model.