Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot visualise #3216

Closed
willgdjones opened this issue Jul 13, 2016 · 14 comments
Closed

Cannot visualise #3216

willgdjones opened this issue Jul 13, 2016 · 14 comments

Comments

@willgdjones
Copy link

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)
in ()
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'

@willgdjones
Copy link
Author

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: jfilippidis@gmail.com
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

@nouiz
Copy link
Contributor

nouiz commented Jul 13, 2016

New pydot version break many packages.

Use pydot 1.1.0.

pydot/pydot@812e3c4

On Wed, Jul 13, 2016 at 12:11 PM, William Jones notifications@github.com
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: jfilippidis@gmail.com
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
#3216 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AALC-8pzq3b2kwCnHJiv1hOut-rXbaLfks5qVQ4XgaJpZM4JLlWI
.

@willgdjones
Copy link
Author

Thanks @nouiz

@johnyf
Copy link
Contributor

johnyf commented Jul 13, 2016

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.

@nouiz
Copy link
Contributor

nouiz commented Jul 13, 2016

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.

@johnyf
Copy link
Contributor

johnyf commented Jul 13, 2016

Please see this comment: pydot/pydot@812e3c4#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.

@ogrisel
Copy link
Contributor

ogrisel commented Aug 8, 2016

@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".

@0bserver07
Copy link
Contributor

This still seems to be an issue, did you folks got it resolved?

I have:

  • keras 1.0.7
  • Theano-0.8.2 then tried Theano-0.9.0.dev2

I 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.

@varoudis
Copy link

Pydot-ng fixes it
I had the same problem

@0bserver07
Copy link
Contributor

0bserver07 commented Aug 11, 2016

@varoudis 🙌 ! Works like a charm, Thanks...

@malaikannan
Copy link

@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.

@johnyf
Copy link
Contributor

johnyf commented Sep 1, 2016

In Theano the problem has been fixed, as reported here: pydot/pydot@812e3c4#commitcomment-18266611, and the latest release of pydot is 1.2.2.

@ogrisel
Copy link
Contributor

ogrisel commented Sep 1, 2016

@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.

@malaikannan
Copy link

Thanks @ogrisel pydot 1.1.0 worked for me and thanks for all the amazing contribution to Scikit-learn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants