New Error

Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.




/home/adminuser/venv/lib/python3.9/site-packages/sklearn/base.py:347: InconsistentVersionWarning: Trying to unpickle estimator DecisionTreeClassifier from version 1.2.2 when using version 1.3.0. 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
  warnings.warn(
2023-08-28 06:47:17.105 Uncaught app exception
Traceback (most recent call last):
  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/amrita_bcai/test.py", line 12, in <module>
    cancer_first_model = pickle.load(open('Random_forest_v1.pkl', 'rb'))
  File "sklearn/tree/_tree.pyx", line 714, in sklearn.tree._tree.Tree.__setstate__
  File "sklearn/tree/_tree.pyx", line 1418, in sklearn.tree._tree._check_node_ndarray
ValueError: node array from the pickle has an incompatible dtype:
- expected: {'names': ['left_child', 'right_child', 'feature', 'threshold', 'impurity', 'n_node_samples', 'weighted_n_node_samples', 'missing_go_to_left'], 'formats': ['<i8', '<i8', '<i8', '<f8', '<f8', '<i8', '<f8', 'u1'], 'offsets': [0, 8, 16, 24, 32, 40, 48, 56], 'itemsize': 64}
- got     : [('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]

I am receiving this particular error while deploying my web application on streamlit cloud. But application works fine while deployed as Streamlit host

My app repository is

Hey @RATUL_BHOWMIK,

I was able to resolve this issue by pinning the version of scikit-learn to 1.2.2 (based on this thread).

Your requirements.txt would look like:

numpy
pickle-mixin
streamlit
streamlit-option-menu
scikit-learn==1.2.2

I was able to deploy a forked version of your app here.

Thank you for your help

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.