I have GraphViz 2.32 installed in Windows 8 and have added C:\\Program Files (x86)\\Graphviz2.32\\bin to the System PATH variable. Still pydot is unable to find its executab
In Windows, even after installing graphviz-2.38.msi, you can add your own path in pydot.py (found under site-package folder)
if os.sys.platform == 'win32':
# Try and work out the equivalent of "C:\Program Files" on this
# machine (might be on drive D:, or in a different language)
#
if os.environ.has_key('PROGRAMFILES'):
# Note, we could also use the win32api to get this
# information, but win32api may not be installed.
path = os.path.join(os.environ['PROGRAMFILES'], 'ATT', 'GraphViz', 'bin')
else:
#Just in case, try the default...
path = r"C:\PYTHON27\GraphViz\bin" # add here.
I found a manual solution: sudo apt-get install graphviz
graph.write('test.dot') dot -Tps test.dot -o outfile.ps
You can the files here: https://github.com/jecs89/LearningEveryDay/tree/master/GP
In "pydot.py" (located in ...\Anaconda3\Lib\site-packages), replace:
def get_executable_extension():
# type: () -> str
if is_windows():
return '.bat' if is_anacoda() else '.exe'
else:
return ''
with:
def get_executable_extension():
# type: () -> str
if is_windows():
return '.exe'
else:
return ''
There does not seem to be any eason to add ".bat" when the system is "Windows/Anaconda" vs "Windows" and there may be no ".bat" associated with the ".exe". This seems better than adding a ".bat" for every executable pydot calls...
If you dont want to mess around with path variables (e.g. if you are no admin) and if you are working on windows, you can do the following which solved the problem for me.
Open graphviz.py
(likely located in ...Anaconda\pkgs\graphviz***\Library\bin
) in an editor. If you cant find it you might be able to open it via the error message.
Go to the fuction __find_executables
and replace:
elif os.path.exists(os.path.join(path, prg + '.exe')):
if was_quoted:
progs[prg] = '"' + os.path.join(path, prg + '.exe') + '"'
else:
progs[prg] = os.path.join(path, prg + '.exe')
with
elif os.path.exists(os.path.join(path, prg + '.bat')):
if was_quoted:
progs[prg] = '"' + os.path.join(path, prg + '.bat') + '"'
else:
progs[prg] = os.path.join(path, prg + '.bat')
I used conda install python-graphviz then conda install pydot and then conda install pydot plus and then it worked.
So:
conda install python-graphviz
conda install pydot
conda install pydotplus
after doing all the installation of graphviz, adding to the PATH of environment variables, you need to add these two lines:
import os
os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/'