File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.__dict__)File "/mount/src/customerchurn/pages/Prediction.py", line 15, in <module>
xgb_pipe = pickle.load(pickled_model)
Whenever you unpickle a model, remember to import the associated Python class beforehand. In your specific case, import the class of xgb_pipe before unpickling it.
Can’t test right now, but try importing sklearn at the top of the file. Your xgb_pipe object needs to recognize the Pipeline class when it is unpickled, so maybe try:
It didn’t work .Now gives such error ModuleNotFoundError: No module named ‘sklearn’
Traceback:
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.__dict__)File "/mount/src/customerchurn/pages/Prediction.py", line 9, in <module>
import sklearn
The versions of the some of packages like pandas ,numpy ,xgboost etc are different in streamlit cloud and in my jupyter notebook.Can it be the reason for this problem?
I just tested the Prediction.py page of your app in my local machine and it works. Make sure your requirements.txt has all the libraries and versions you need, so Streamlit Cloud takes them into account. Not specifying versions or specifying versions you haven’t tested is a common reason for errors.