title: Loading XGBoost model from pickle file. Error: 'XGBClassifier' object has no attribute 'use_label_encoder'
body: <p>I am trying to load a serialized xgboost model from a pickle file.</p>
  <pre><code>import pickle
  def load_pkl(fname):
      with open(fname, 'rb') as f:
          obj = pickle.load(f)
      return obj
  
  model = load_pkl('model_0_unrestricted.pkl')
  </code></pre>
  <p>while printing the model object, I am getting the following error in linux(AWS Sagemaker Notebook)</p>
  <pre><code>    ~/anaconda3/envs/python3/lib/python3.6/site-packages/xgboost/sklearn.py in get_params(self, deep)
      436             if k == 'type' and type(self).__name__ != v:
      437                 msg = 'Current model type: {}, '.format(type(self).__name__) + \
  --&gt; 438                       'type of model in file: {}'.format(v)
      439                 raise TypeError(msg)
      440             if k == 'type':
  
  ~/anaconda3/envs/python3/lib/python3.6/site-packages/sklearn/base.py in get_params(self, deep)
      193         out = dict()
      194         for key in self._get_param_names():
  --&gt; 195             value = getattr(self, key)
      196             if deep and hasattr(value, 'get_params'):
      197                 deep_items = value.get_params().items()
  
  AttributeError: 'XGBClassifier' object has no attribute 'use_label_encoder'
  </code></pre>
  <p>Can you please help to fix the issue?</p>
  <p>It is working fine in my local mac.</p>
  <p>Ref: xgboost:1.4.1 installation log (Mac)</p>
  <pre><code>    Collecting xgboost
    Downloading xgboost-1.4.1-py3-none-macosx_10_14_x86_64.macosx_10_15_x86_64.macosx_11_0_x86_64.whl (1.2 MB)
       
  </code></pre>
  <p>But not working on AWS</p>
  <p>Ref: xgboost:1.4.1 installation log (SM Notebook, linux machine)</p>
  <pre><code>Collecting xgboost
    Using cached xgboost-1.4.1-py3-none-manylinux2010_x86_64.whl (166.7 MB)
  </code></pre>
  <p>Thanks</p>