How to generate png file on Pycharm?

So I’m just getting started with this, and have all the necessary libraries imported. But I’m trying to create physical graphs from trees.

I’ve tried:

UniqueDotExporter(Food).to_picture(“Foods.png”)

This gives the “file not found” error, as if Pycharm thinks I’m trying to write to an existing file, without realizing the whole purpose is to generate one. So how does this method work…are you first supposed to create a png file somehow?

Then I try this method:

DotExporter(Food).to_dotfile(“foods.dot”)
(graph,) = pydot.graph_from_dot_file(‘foods.dot’)

Both of those lines are executed without an error. It created the dot file as a Word document,
and I’m certain it’s in my active directory.

But then I try the next step:
graph.write_png(‘foods.png’)

It gives the error: [WinError 2] “dot” not found in path.

How am I supposed to add “dot” to the path? It’s not the name of a folder; it’s the format of a document that’s already there.

I’ve also heard that “pip install Graphviz” doesn’t really work properly, and that you have to download it directly from this site (which I did). But there’s still the issue of “adding it to your path.” Not sure what that entails.

Any idea what’s going on here?

Thanks

(I apologize if this seems to talk down to your abilities, no insult intended)
When you downloaded it from this site, did you download an item that said

If it did NOT say “EXE installer”, please download & then install it (click on it)
Then open a cmd window and type dot -V. It should report the Graphviz version.

Thanks…I don’t quite recall, but I’ll try again to confirm I’ve downloaded EXE.
I’ve also seen several people say that Conda/Anaconda is the best way to go. Would you agree with that?

*UPDATE: I did do this with EXE. I ensured that I downloaded Graphviz in the “systems’ path.”

I did what you said with cmd, and it reported the GraphViz version just fine.

Yet PyCharm still says, “ExecutableNotFound: failed to execute WindowsPath(‘dot’), make sure the Graphviz executables are on your systems’ PATH.” And it won’t even go past the point of “rendering” (‘dot’, ‘png’, ‘fname.dot’).

So what else could I be doing wrong?

I have no useful experience with any of these, but since Graphviz is correctly installed, maybe the PyCharm folks could help you out.

Doubtful…this isn’t the most mainstream Python topic, and I’m not aware of a Pycharm forum equivalent to this one. I’m not seeing much use for AnyTree at this point anyway, but there may be other Pycharm programs/API’s where I could use Graphviz/Dot.

I’m going to take everyone’s suggestion and install Anaconda, then reinstall Graphviz from there. Also wondering if using Jupyter would take care of the problem.