I am running Python3.4 on Windows 7. I am trying to use the Python interface for graphviz. This is a script I intend to run:
from graphviz import Digraph
imp
To solve this problem,when you install graphviz2.38 successfully, then add your PATH variable to system path.Under System Variables you can click on Path and then clicked Edit and added ;C:\Program Files (x86)\Graphviz2.38\bin to the end of the string and saved.After that,restart your pythonIDE like spyper,then it works well.
Don't forget to close Spyder and then restart.
For all those who are facing this issue in windows 10 even after trying the above mentiond steps, this worked for me -
For Windows 10 users trying to debug this same error, launch CMD as administrator (important!) and run dot -c
and then run dot -v
This fixed the issue for me
The simplest solution which worked for me (Windows 10, Jupyter Notebook) for this problem is to do the following:
import sys sys.path.append('C:/Users/usrname/AppData/Local/Continuum/anaconda3/Library/bin/graphviz/')
I encountered the same problem in Jupyter Notebook. Add this, and you are good to go.
import os
os.environ['PATH'] = os.environ['PATH']+';'+os.environ['CONDA_PREFIX']+r"\Library\bin\graphviz"
I had faced same problem while trying to create decision tree through pydotplus and graphviz. And used the path variable method to resolve this issue.
Below are the exact steps I used:
Although I already had graphviz through conda install command , I re-downloaded the latest package from below path. https://graphviz.gitlab.io/_pages/Download/Download_windows.html Downloaded : graphviz-2.38.zip (Stable Release)
Copied the extracted folder under following path on C: Drive. C:\Program Files (x86)\
Modified the system path variable and added following path to it. Path Variable : Control Panel > System and Security > System > Advance system Setting > Environment Variable > Path C:\Program Files (x86)\graphviz-2.38\release\bin;
After adding above path to environment variable , restarted the system.
It worked fine , and I was able to create Decision tree into png.
enter image description here
I also had this problem on Ubuntu 16.04.
Fixed by running sudo apt-get install graphviz
in addition to the pip install I had already performed.