Open Side Menu Go to the Top
Register
Help w/ Python Anaconda: GraphViz Help w/ Python Anaconda: GraphViz

01-24-2015 , 06:59 PM
Hi, I am working through a video series by Will Tipton (very well-known author of two pretty sophisticated books on NLHU, both of which with a corrsponding video series). In the video to his second book, he explains how to program a tool to simulate heads-up play with Anaconda (32-bit) IPython (Py 2.7) Notebook. In order to draw game trees, GraphViz needs to be installed. I set the path variable, but when I want to have a game tree drawn, I get an error message; apparently, IPython doesn't find GraphViz despite the path variable being set.

I posted my question already in the heads-up forum thread that deals with Will Tipton's book, but thought it might be a good idea to post it here too, since it is a computer question more than a question about poker or even W.T.'s code ... I have just lost three days on some similar installation issue which, once someone in a Python forum told me what to do, was a matter of seconds to resolve, and this here is probably as quickly to resolve for someone who actually knows about this stuff. I'd just love to make progress with that awesome video series, so thanks a lot for input already

Quote:
Originally Posted by +VLFBERH+T
Puh, I'm not a programmer, and seemingly tiny things can really stall one's efforts ... in my post above, I had the issue that "pip install pydot2" didn't work, apparently because the Anaconda Command Prompt couldn't find pip at all. For those who read this and come across the same problem: for some reason, I had to state the whole path where pip.exe is, in the command: "C:\Users\...\Anaconda\Scripts\pip install pydot2".

That just took me three days ...

Now, I am like 10 minutes further in video 11 (installed the PATH variable, including the "bin\" part, i.e. including that last backslash, and rebooted even my computer after that), but get the following error:



So, "GraphViz's executables not found" ... what I find on the web is mostly the tip to install GraphViz, and set the PATH variable, but I've obviously done that ...

I so hope I don't have to spend days again on this one ... has anyone encountered the same problem, despite following the instructions ?
Help w/ Python Anaconda: GraphViz Quote
01-25-2015 , 12:59 AM
I've heard Windows Python is a bit fiddly about environment variables, try right clicking on 'Computer' from the Start menu, or 'My Computer' on the desktop, click 'Properties', then 'Advanced' and finally 'Environment Variables' and manually edit the PATH variable to include the path to GraphViz.

EDIT: guess I didn't read very carefully, try running the interpreter, run 'import sys' and then 'print sys.path' to make sure the path to GraphViz is there, if not you didn't set the PYTHONPATH variable properly.
Help w/ Python Anaconda: GraphViz Quote
01-25-2015 , 01:31 AM
Here is a screenshot of what you're looking for.



To get here go to my computer and right click. Select properties then advanced system settings then environmental variables. You want to set the path in the User variables, not in the system variables. Path variables take the form of:

path;

So your path variable looks something like path1;path2;path3;path4;

Let's say the program you're trying to run is located at :
C:\program files\my-program\someprogram.exe

You would add the following to the User Path variable:
C:\program files\my-program;

If you wanted to run it from the CMD prompt you would just type the name of the program which in this case is someprogram. Furthermore, if you don't like typing the full name of the file each time into the CMD prompt you can bind the exe to a shorter name. I don't recall how to do that but you should be able to find it with a little googling.
Help w/ Python Anaconda: GraphViz Quote
01-25-2015 , 08:21 AM
Hi, thank you both very much for your input ...

The correct path should be this: C:\Program Files (x86)\Graphviz2.38\bin This path leads to gvpack.exe



Craggoo, I had set the path variable manually, exactly as you descibed:



But when I do 'import sys' and then 'print sys.path' as weevil suggests, it seems very much like GraphViz isn't there ..?! Does that help to narrow down the problem ?
Help w/ Python Anaconda: GraphViz Quote
01-25-2015 , 01:26 PM
Looks like GraphViz couldn't detect the path to your python installs site-packages directory since you're using Anaconda, it should have installed the python modules there and modified your PYTHONPATH itself. Looks like there's a few current conda repackages of graphviz, you could try uinstalling graphviz then running 'conda install -c https://conda.binstar.org/mutirri graphviz' or even rerunning the GraphViz installer and check if you can manually point it to install modules in your Anaconda\site-packages dir. My guess though would be that Anaconda doesn't work well with modules not installed through conda.

EDIT: oops, that looks to be a linux repackage. Check out this stackoverflow article or this one and see if that helps. Sorry I have no experience with Anaconda or this package, you might have an even harder time than it looks like most people are having getting it to run on Windows who are using the regular Python 2.7 Windows installation.

Last edited by weevil; 01-25-2015 at 01:33 PM.
Help w/ Python Anaconda: GraphViz Quote
02-02-2015 , 02:18 PM
Hi all ... I am still none the wiser ... I had a guy from the local Python Meet-Up look over it, and we installed GraphViz again. Now, strangely, a new error message shows up



The error message is truncated, for some reason. The dude from the Python Meet-Up didn't have any more time, and suggested I google this new error, but couldn't find anything for this 'InvocationException' - have any of you seen this before ?
Help w/ Python Anaconda: GraphViz Quote
02-02-2015 , 05:34 PM
Quote:
Originally Posted by +VLFBERH+T
Hi all ... I am still none the wiser ... I had a guy from the local Python Meet-Up look over it, and we installed GraphViz again. Now, strangely, a new error message shows up



The error message is truncated, for some reason. The dude from the Python Meet-Up didn't have any more time, and suggested I google this new error, but couldn't find anything for this 'InvocationException' - have any of you seen this before ?
I want to add that it seems that GraphViz does not recognize png's:



Any ideas why that could be ?
Help w/ Python Anaconda: GraphViz Quote
02-02-2015 , 11:49 PM
Again, not really my field of expertise but it looks like the exception is coming from iPythons Image module. Sounds like you have way too much junk working together.. iPython, Anaconda, Pydot/GraphViz. Try doing a clean Python installation without all that junk then install what you need.
Help w/ Python Anaconda: GraphViz Quote
02-03-2015 , 04:44 AM
Quote:
Originally Posted by weevil
Again, not really my field of expertise but it looks like the exception is coming from iPythons Image module. Sounds like you have way too much junk working together.. iPython, Anaconda, Pydot/GraphViz. Try doing a clean Python installation without all that junk then install what you need.
Hi ... Anaconda is the name of the iPython distribution, as far as I understand, so Anaconda and iPython is kind of the same thing, and Pydot and GraphViz are installed specifically to draw those decision trees. In Will Tipton's video series, he shows how to install them, one after the other, i.e. both are needed and apparently work just fine on his system (also Windows 7). Only that I first had a problem with Pydot, which stopped me for like 3 days, and now, just 10 mins further into the video, I have these GraphViz problems, which have been holding me back for much longer than that already ...
Help w/ Python Anaconda: GraphViz Quote
02-03-2015 , 11:49 AM
Python Environment Variables

A guess but configuring PYTHONPATH correctly might do the trick.
Help w/ Python Anaconda: GraphViz Quote

      
m