Module 'pycaret.internal.preprocess' has no attribute 'DataTypes_Auto_infer'

Hi I am having problem to load model for prediction. When I run the model_load, it gives me error message. My python version 3.7.13. My pycaret version is 3 and there is no list of version for me to select.

Below is the code to save the model from google colab:

Below is the code to load the model:

Below is the error message:

Hi @AliceKoh , thanks for submitting your issue!

I’m not exactly sure what is going on from the messages but if you give me code to copy and paste instead of pictures, I can maybe do some more debugging on Streamlit’s side to try to understand the issue.

Hi Willhuang,

Summary of my issue:
I created my model in google colab. Now I want to use the model to predict in streamlit. So I save a copy to be used at streamlit. However I have problem to load the model.

Below is my code at streamlit.
import streamlit as st
import pandas as pd
import numpy as np
from pycaret.classification import load_model, predict_model
model = load_model(“Final_Modeldt”)

This code looks ok. I think the issue might be the .plk file. I want to know why the model which is generated at colab (can load in colab) but cannot load at streamlit and how to fix it.

I share the link to my files here.

When loading pickle files, it’s important to ensure that the versions of Python packages used to create the pickle files are identical to the versions used when loading the files. i.e. ensure the Python packages you use locally are the same versions as those on Google Colab.

In particular, as the message says a pycaret attribute isn’t found, I would check the pycaret version differences locally vs on Colab.

1 Like

The DataTypes_Auto_infer attribute was last present in pycaret version 2.3.10:

It does not exist in version 3 that you have locally installed. The solution is to downgrade your version of pycaret.

1 Like

hey snehankekre. I think it is really due to the miss match of version between colab pycaret and my anaconda version for streamlit. I tried to redo my model using anaconda version jupyer and the model load without problem at the same anaconda for streamlit. I cant wait to apply the new model to my apps. Hope it works too. Will keep you update. thanks for your help

Hello sir @snehankekre , i have the same problem with @AliceKoh Alice,

I use pycaret with Kafka streaming, when i want to downgrade the pycaret package for the version 2.3.10 , i have this error.

How i can resolve this problem ? to load my model in kafka? i cannot downgrade pycaret.

Hi, I have the same issue and it is not a problem of version of pycaret because I use the same virtual environment between my jupyter notebook and my python script in VSCode.

It has been a day I am trying to load the pipeline.pkl I saved in my notebook without success.

I consider strongly not to use pycaret anymore, or only to see which model perform better and then develop the model myself. I got too many bugs with pycaret when trying to use it with streamlit, and I am not sure anymore it is reliable…