Caffe: Exception: “dot” not found in path in python on mac

Created on 27 Oct 2016  Â·  10Comments  Â·  Source: BVLC/caffe

I want to use python ./python/draw_net.py ../models/bvlc_reference_caffenet/train_val.prototxt caffenet.pngto draw the caffe net by anaconda python on mac. But I got the error like this:
Traceback (most recent call last):

  File "caffe/distribute/python/draw_net.py", line 45, in <module>
    main()
  File "caffe/distribute/python/draw_net.py", line 41, in main
    caffe.draw.draw_net_to_file(net, args.output_image_file, args.rankdir)
  File "/Users/xxh/caffe/distribute/python/caffe/draw.py", line 222, in draw_net_to_file
    fid.write(draw_net(caffe_net, rankdir, ext))
  File "/Users/xxh/caffe/distribute/python/caffe/draw.py", line 204, in draw_net
    return get_pydot_graph(caffe_net, rankdir).create(format=ext)
  File "/Users/xxh/anaconda2/lib/python2.7/site-packages/pydot.py", line 1883, in create
    prog=prog))
Exception: "dot" not found in path.

I have installed pydot and graphviz ,and how can I add the dot's path to python path?

Most helpful comment

If you are still getting the error, I suppose you installed pydot and graphviz using pip.
Please use :
sudo apt-get install graphviz
pip install pydot
If this gives you permission issues please use:
sudo pip install pydot
This will install the complete graphviz from Ubuntu.

After this the draw_net.py runs correctly.

All 10 comments

You don't have "dot" install from source http://www.graphviz.org/pub/graphviz/CURRENT/graphviz-working.tar.gz and all works

As explained here:
http://stackoverflow.com/questions/13987353/python-valueerror-program-dot-not-found-in-path

You need to have graphviz installed on your system. Ex, on fedora, run

sudo dnf install -y graphviz

If you are still getting the error, I suppose you installed pydot and graphviz using pip.
Please use :
sudo apt-get install graphviz
pip install pydot
If this gives you permission issues please use:
sudo pip install pydot
This will install the complete graphviz from Ubuntu.

After this the draw_net.py runs correctly.

I had a similar issue, which occurred after I ran make pytest. After reading over several discussions/posts, I found it seems to be due to you not installing graphviz to your system. Installing graphviz merely through pip install graphviz is not enough, since the graphviz python module seems to be only a python wrapper. For my case, I did brew install graphviz and it solved my problem. See: https://stackoverflow.com/a/36890526/5859802.

@benxgh1996 Thanks, the command: brew install graphviz worked for me also.

Hello,

How can I do this on windows?
I have the same problem.. I'm using spyder python.

I saw the https://stackoverflow.com/a/36890526/5859802.
But I didn't understand what I need to do.
Can you help me?

I had a similar issue, which occurred after I ran make pytest. After reading over several discussions/posts, I found it seems to be due to you not installing graphviz to your system. Installing graphviz merely through pip install graphviz is not enough, since the graphviz python module seems to be only a python wrapper. For my case, I did brew install graphviz and it solved my problem. See: https://stackoverflow.com/a/36890526/5859802.
In my case too same happened. Thanks for the solution!
Just wanted to know the difference between brew install and pip install.

for OSX please use brew install graphviz to solve your problem

brew install graphviz didn’t work for me in OSX. What can I do?

give docker a try maybe

Was this page helpful?
0 / 5 - 0 ratings