Aqua 4
Aqua 4

Reputation: 871

ImportError: cannot import name 'plot_tree' from 'sklearn.tree'

Import error when importing plot_tree from sklearn

after doing pip install sklearn

Error-Log:

from sklearn.tree import DecisionTreeClassifier, plot_tree

ImportError: cannot import name 'plot_tree' from 'sklearn.tree'

Upvotes: 1

Views: 9497

Answers (2)

MosQuan
MosQuan

Reputation: 140

Plot tree is available after sklearn version > 0.21.

pip install --upgrade sklearn

could help but if it isn't you have to upgrade the whole python version.

I had the same issue on 3.6.7 python and solve it by installing 3.7.7.

Upvotes: 2

Aqua 4
Aqua 4

Reputation: 871

Install scikit-learn

Fix:

pip install scikit-learn

Upvotes: 0

Related Questions