AttributeError: type object 'sklearn.tree._criterion.array' has no attribute '__reduce_cython__'

Question:

I want to import
from sklearn.tree import DecisionTreeRegressor in jupyter.
but when I run just the line contains above import, I got this error.

<ipython-input-16-28b3e81cd98d> in <module>
----> 1 from sklearn.tree import DecisionTreeRegressor

~/.local/lib/python3.6/site-packages/sklearn/tree/__init__.py in <module>
      4 """
      5 
----> 6 from ._classes import BaseDecisionTree
      7 from ._classes import DecisionTreeClassifier
      8 from ._classes import DecisionTreeRegressor

~/.local/lib/python3.6/site-packages/sklearn/tree/_classes.py in <module>
     38 from ..utils.validation import check_is_fitted
     39 
---> 40 from ._criterion import Criterion
     41 from ._splitter import Splitter
     42 from ._tree import DepthFirstTreeBuilder

~/.local/lib/python3.6/site-packages/sklearn/tree/_criterion.cpython-36m-x86_64-linux-gnu.so in init sklearn.tree._criterion()

AttributeError: type object 'sklearn.tree._criterion.array' has no attribute '__reduce_cython__'

I tried to install scipy and update scikit-learn by conda but it didn’t solved.

Asked By: Maede

||

Answers:

Try to update Cython :

pip install cython
Answered By: Mahrez BenHamad