Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SimpleImputer object has no attribute _fit_dtype

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?

like image 466
Jakob Avatar asked Mar 26 '26 08:03

Jakob


1 Answers

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
like image 96
Jakob Avatar answered Mar 28 '26 21:03

Jakob