Love the library btw. This seems to be an issue with pydot from what I can tell.
from keras.utils.visualize_util import plot
AttributeError Traceback (most recent call last)
17 from PIL import Image
18 import matplotlib.pyplot as plt
---> 19 from keras.utils.visualize_util import plot
20 get_ipython().magic(u'matplotlib inline')
21
/Users/fonz/anaconda/lib/python2.7/site-packages/keras/utils/visualize_util.py in
5 # fall back on pydot if necessary
6 import pydot
----> 7 if not pydot.find_graphviz():
8 raise RuntimeError('Failed to import pydot. You must install pydot'
9 ' and graphviz for pydotprint to work.')
AttributeError: 'module' object has no attribute 'find_graphviz'
Here is my pydot version:
Metadata-Version: 2.0
Name: pydot
Version: 1.2.2
Summary: Python interface to Graphviz's Dot
Home-page: https://github.com/erocarrera/pydot
Author: Ioannis Filippidis
Author-email: [email protected]
Installer: pip
License: MIT
Location: /Users/fonz/anaconda/lib/python2.7/site-packages
Requires: pyparsing
Classifiers:
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Topic :: Scientific/Engineering :: Visualization
Topic :: Software Development :: Libraries :: Python Modules
New pydot version break many packages.
Use pydot 1.1.0.
https://github.com/erocarrera/pydot/commit/812e3c40dac1e0225391481073c64da5bafba93e
On Wed, Jul 13, 2016 at 12:11 PM, William Jones [email protected]
wrote:
Here is my pydot version:
Metadata-Version: 2.0
Name: pydot
Version: 1.2.2
Summary: Python interface to Graphviz's Dot
Home-page: https://github.com/erocarrera/pydot
Author: Ioannis Filippidis
Author-email: [email protected]
Installer: pip
License: MIT
Location: /Users/fonz/anaconda/lib/python2.7/site-packages
Requires: pyparsing
Classifiers:
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Topic :: Scientific/Engineering :: Visualization
Topic :: Software Development :: Libraries :: Python Modules—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/fchollet/keras/issues/3216#issuecomment-232405186,
or mute the thread
https://github.com/notifications/unsubscribe/AALC-8pzq3b2kwCnHJiv1hOut-rXbaLfks5qVQ4XgaJpZM4JLlWI
.
Thanks @nouiz
The solution to the issue reported above is to remove the call pydot.find_graphviz from here: https://github.com/fchollet/keras/blob/fd3cfb196b2be22c274cc7b7f0abbd1c8e87a2c2/keras/utils/visualize_util.py#L7.
Please let pydot itself search for GraphViz executables, and complain if not found in the $PATH, which is the user's responsibility to install.
I don't like the idea of postponing the error. WIth the old version, we where able to give an error to the user when it was importing the optional module that use pydot.
Now, the error can happen after hours of computation.
We just need this method to do what pydot currently do when it get called. We don't need the old check, just the current check. This allow much better user error.
Please see this comment: https://github.com/erocarrera/pydot/commit/812e3c40dac1e0225391481073c64da5bafba93e#commitcomment-18236709, where I describe how you can still check early, without duplicating the subprocess-related code, by calling the method create of an empty graph.
@johnyf the error raised by pydot if graphviz is not installed is the following:
Exception: "dot" not found in path.
This is error message is not explicit enough for users of third party libraries like theano or keras that use pydot has an internal dependency. The end users do not necessarily know that the dot command is provided by graphviz. Furthermore the use of a generic exception type such as Exception makes it impossible for the third party library developers to catch the exception and raise a more informative user message such as "graphviz is required to use this visualization. Please install it and ensure that the 'dot' command can be found in the path".
This still seems to be an issue, did you folks got it resolved?
I have:
keras 1.0.7Theano-0.8.2 then tried Theano-0.9.0.dev2I tried installing older pydot as well, pydot==1.1.0, but still this error shows up:
/usr/local/lib/python2.7/site-packages/keras/utils/visualize_util.py in <module>()
5 # fall back on pydot if necessary
6 import pydot
----> 7 if not pydot.find_graphviz():
8 raise RuntimeError('Failed to import pydot. You must install pydot'
9 ' and graphviz for `pydotprint` to work.')
AttributeError: 'module' object has no attribute 'find_graphviz'
It looks like removing pydot.find_graphviz() could resolve this issue, but it's still here visualize_util.py#L7L-7.
Pydot-ng fixes it
I had the same problem
@varoudis 🙌 ! Works like a charm, Thanks...
@varoudis did you change visualize_util.py to import pydotng?? I am running into the same issue , installed pydot 1.1.0 still doesn't seem to fix it.
In Theano the problem has been fixed, as reported here: https://github.com/erocarrera/pydot/commit/812e3c40dac1e0225391481073c64da5bafba93e#commitcomment-18266611, and the latest release of pydot is 1.2.2.
@varoudis did you change visualize_util.py to import pydotng?? I am running into the same issue , installed pydot 1.1.0 still doesn't seem to fix it.
It's already the case. install pydotng instead of pydot.
Thanks @ogrisel pydot 1.1.0 worked for me and thanks for all the amazing contribution to Scikit-learn.
Most helpful comment
Pydot-ng fixes it
I had the same problem