Exception: "dot" not found in path in python on mac

XiaXuehai picture XiaXuehai · Oct 25, 2016 · Viewed 13.4k times · Source

I want to use caffe.draw to draw the caffe net by anaconda python on mac. But I got the error like this:

File "python/draw_net.py", line 45, in <module>
    main()
  File "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?

Answer

Ayushi Agarwal picture Ayushi Agarwal · Jul 28, 2017

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.