It mainly depends on where you put the pydot files. If you are running it straight from the Python Shell then you should have them installed in the modules folder which is most commonly the "Lib" folder inside the main python folder.
Python RuntimeError: Failed to import pydot
Frage
I am learning concepts of logistic regression concepts. When i implement it in python, it shows me some error mentioned below. I am beginner in python. Could anybody help to rectify this error?
RuntimeError Traceback (most recent call last) in ()
64 theano.printing.pydotprint(predict,
65 outfile="pics/logreg_pydotprint_predic.png",
66 var_with_name_simple=True)
67 # before compilation
68 theano.printing.pydotprint_variables(prediction,
C:\Anaconda\lib\site-packages\theano\printing.pyc in pydotprint(fct, outfile, compact, format, with_ids, high_contrast, cond_highlight, colorCodes, max_label_size, scan_graphs, var_with_name_simple, print_output_file, assert_nb_all_strings)
565
566 if not pydot_imported:
567 raise RuntimeError("Failed to import pydot. You must install pydot"
568 " for `pydotprint` to work.")
569 return
RuntimeError: Failed to import pydot. You must install pydot for pydotprint
to work.
Lösung 2
Andere Tipps
I got the same error and I did the following sequence to make it work, in a Python 3:
source activate anaconda
pip install pydot
pip install pydotplus
pip install pydot-ng
Then you download and install Graphviz from here according to your OS type: http://www.graphviz.org/Download..php
If you are running Python on Anaconda, open Spyder from terminal, not from Anaconda. Go to terminal and type:
spyder
Then:
import theano
import theano.tensor as T
.
.
.
import pydot
import graphviz
import pydot_ng as pydot
Develop your model and:
theano.printing.pydotprint(prediction, outfile="/Volumes/Python/prediction.png", var_with_name_simple=True)
I also have the same issue. I would suggest you post this in the Github Theano Issues forum:
https://github.com/Theano/Theano/issues?direction=desc&sort=updated&state=open
It seems to me, that since this instance of the pydotprint() function is actually part of the printing module within the Theano library that this should not be an issue (but it is) and hence it should be brought to the attention of the developers in order to fix it.
Please correct me if this is not the case.