3

I have a trained scikit-learn model pipeline (including a SimpleImputer) that I'm trying to put into production. However, I get the following error when running it in the production environment.

SimpleImputer object has no attribute _fit_dtype

How do I solve this?

Alexander L. Hayes
  • 3,892
  • 4
  • 13
  • 34
Jakob
  • 663
  • 7
  • 25

1 Answers1

3

This is a result of using different versions of scikit-learn in the development and production environments. The model has been trained using one version and then it's used with a different version.

This can be solved by storing the current library versions in the development environment in a requirements.txt file using:

pip list --format=freeze > requirements.txt

In the production environment, install the same library versions with:

pip install -r requirements.txt
Jakob
  • 663
  • 7
  • 25