AttributeError while deploying my app on streamlit


I just tested my pickle file in this jupyter notebook and I have uploaded this in my git hub repo,
also I rebooted my app just a hit and trial …
still the problem is the same
AttributeError: 'str' object has no attribute 'transform'

@Rishabh_Prasad . Could you share the whole pic of the error for better understanding?

Aren’t you gettng a bunch of warnings like this in Streamlit Cloud logs?

InconsistentVersionWarning: Trying to unpickle estimator Pipeline from
version 1.3.1 when using version 1.4.1.post1. This might lead to breaking
code or invalid results. Use at your own risk. For more info please refer
to:
https://scikit-learn.org/stable/model_persistence.html#security-maintainability-limitations

yes I am getting this warning

  warnings.warn(

/home/adminuser/venv/lib/python3.9/site-packages/sklearn/base.py:376: InconsistentVersionWarning: Trying to unpickle estimator ColumnTransformer from version 1.3.1 when using version 1.4.1.post1. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to:

https://scikit-learn.org/stable/model_persistence.html#security-maintainability-limitations

So now you know where the problem lies.


Yes, I was also thinking the same, Initially this was not the issue,
But I have used sklearn version 1.3.1 for all the task in my notebook.
Does streamlit cloud use the latest sklearn version?

Usually the latest available version will be installed in Streamlit Cloud unless you tell it otherwise. The warning says:

Trying to unpickle estimator Pipeline from version 1.3.1 when using version 1.4.1.post1

And Streamlit Cloud logs every package that is installed and its version.

Thank you so much streamlit community for all your time and effort, helping me out to solve my error in deploying my streamlit app.
I have finally resolved my error and have deployed my app successfully,
I just added scikit-learn == 1.3.1 in the requirements.txt files and it worked.

2 Likes