Why "png" format is not recognizable in Decision Tree Python?

510 Views Asked by At

Code:

graph = pdot.graph_from_dot_data(dot_data.getvalue())  
Image(graph.create_png())

Got the following error during execution:

InvocationException :Traceback (most recent call last)
<ipython-input-17-1d44fd70829d> in <module>
      3 #(graph,) = pydot.graph_from_dot_data(dot_data.getvalue())
      4 graph = pdot.graph_from_dot_data(dot_data.getvalue())
----> 5 Image(graph.create_png())

D:\Jupi\lib\site-packages\pydotplus\graphviz.py in <lambda>(f, prog)
   1795             self.__setattr__(
   1796                 'create_' + frmt,
-> 1797                 lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
   1798             )
   1799             f = self.__dict__['create_' + frmt]

D:\Jupi\lib\site-packages\pydotplus\graphviz.py in create(self, prog, format)
   2030             raise InvocationException(
   2031                 'Program terminated with status: %d. stderr follows: %s' % (
-> 2032                     status, stderr_output))
   2033         elif stderr_output:
   2034             print(stderr_output)

InvocationException: Program terminated with status: 1. stderr follows: Format: "png" not recognized. Use one of:

InvocationException: Program terminated with status: 1. stderr follows: Format: "png" not recognized. Use one of:

Downgraded and Upgraded pydot versions, Uninstalled pydot2 and installed pydot.Tried many alternatives.Still,can't resolve the issue.Help me solve this .Thanks!

1

There are 1 best solutions below

0
On

Are you using Jupyter in the Anaconda environment? Try running this command in Anaconda Prompt:

conda install pydotplus

You can replace your usage of pydot with pydotplus. You could also try

conda install pydot

if you want to stick with pydot.