graph_from_dot_data doesn't provide write_png module

258 Views Asked by At

I have a problem with write_png module of pydotplus.grapg_from_dot_data. Actually, It doesn't even appear as the modules of graph_from_dot_data. This is my code:

dtree = DecisionTreeClassifier()
dtree.fit(X,y)
data = tree.export_graphviz(dtree , out_file=None , feature_names= features)
graph = pydotplus.graph_from_dot_data(data).write_png('mydecisiontree.png')

This is the error raised:

pydotplus.graphviz.InvocationException: GraphViz's executables not found

Do you guys have any idea how to fix it?

1

There are 1 best solutions below

1
On

I had that problem too, I installed GraphViz from here and it solved. be sure to put GraphViz in the environment path