Forums

AssertError:read can not have position excceed buffer length

Hi, I'm having trouble reading an Xgboost model.

Below is the code used: model = pickle.load (open ("model.pickle.dat", "rb"))

Error displayed: AssertError:read can not have position excceed buffer length

The file is correctly located in the directory.

Which version of xgboost did you use to save the model? From this error report on GitHub it looks like that error might be generated if you create a model using a newer version than the one that we have installed on PythonAnywhere.

If (say) you have version 1.2.3 installed locally, and you want to upgrade the version that you're using on PythonAnywhere to match that, and you're using Python 3.8 to run your code here, you can do that with the following Bash command:

pip3.8 install --user xgboost==1.2.3