-
Notifications
You must be signed in to change notification settings - Fork 652
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
pydot issue #7
Comments
This is a bug of Keras. You maybe solve this by removing the Or you can install pydot 1.2.3 by pip. I have not re-tested these solutions, if they work, please let me know. Thanks. @QihongL |
Yes! I commented those lines since I don't need that model diagram. By the way, thanks for the implementation! |
FWIW |
Im running python 3.5. pydot 1.2.3 and i have installed graphviz but plot_model doesn't work. Does anyone have a fix for the plot_model function that corrects whatever is wrong with it? If it helps this is the function in keras.utils.vis_utils.
|
I'm writing this here in case anyone finds this again. Checking the code for
we can see the error raised by the try except clause above. This tries to run a dummy pydot command in to confirm that pydot is installed correctly. So I installed
Under Ubuntu 16.04 I ran:
and it worked. |
Installing |
For future reference: If you're using a Mac using Pip to install graphviz is not enough. You need to use brew |
On Windows I had to install de binaries (https://graphviz.gitlab.io/_pages/Download/Download_windows.html) and then set the bin folder on PATH environment variable |
yup, by install using apt-get works for me as well! |
I did the following for Mac:-
You will see something like this.
And voila! |
None of the above worked for me as none of them were "immediately" applied to my jupyter-notebook session. As I was running a very long code on jupyter and COULD NOT LOSE MY DATA, BY ANY CHANCE, installing these modules was not sufficient, as even reloading the modules would not make the trick. Instead I needed to restart the kernel, or spyder-ide (which would make me lose my data). So I simply opened a terminal (ubuntu here) and edited the /keras/utils/vis_util.py file (for me, using anaconda, it was under: /home/<my_user>/miniconda2/lib/python2.7/site-packages/keras/utils/vis_util.py) and commented the "check_pydot()" call inside the "model_to_dot" function definition. After that, reloading the code inside jupyter-notebook was enough to render the net architecture WITHOUT HAVING TO RESTART THE JUPYTER KERNEL, AND WITHOUT LOSING THE DATA. No other errors appeared, btw, and the net was rendered properly. |
Importing pydot-ng wasn't working for me since I was using python 3.6
|
I also ran into kostistsaprailis's issue but I'm not on a *nix so the previous answers didn't apply. If you're on a Windows machine, obtaining the GraphViz library is slightly less convenient without a native package manager. Looking at |
For those still struggling: First:
As explained, Second, go to where your keras repo is set up. E.g. mine is a
Third, at line 11 of
Ensure graphviz is installed (using |
Download the dll from https://graphviz.gitlab.io/_pages/Download/Download_windows.html and then append the bin folder path in your system path, it will work. The problem is they only check the dot.exe in the system path or machine registration. |
This is a bug, keras should fix it. |
Ensure you have already installed graphviz, pydot, pydotplus.
that's worked for me. |
What a cluster$Q$5 Testing code, encapsulation, robustness to change are all software engineering problems solved decades ago. Data science has thrown them all into the garbage can in order to push out partially working code faster. No thank you. |
I got this error recently, I install the |
I am using windows 10 and had the same issue. First, I commented the "_check_pydot()" as @manuelblancovalentin mentioned above. After that, the code kept doesn't run. So I did what @JialieY said and violà, everything right. |
Thanks. I have googled half of the internet to find this comment to downgrade the package. Thank you very much. |
install pydot_ng solves my problem :) ... again , on my win10 env i have to install graphvis.msi , set bin to path and then pip install pydot_ng to make keras plot_model to work. |
the solution that @kostistsaprailis suggested worked fine for me! |
install graphviz on windows and add bin to env var wokred for me, |
Tried everything and nothing works. It's broken. |
Four years later and it's still broken |
I am on Windows and I finally got it working. The problem was that restarting the kernal in Jupyter Notebook does not restart the system shell, so %PATH% was outdated!!! So the complete solution on Windows:
(What happened: Windows caches %PATH% at the launch of the shell. Restarting the kernal only starts a new python session in the same shell. So even if you start a new kernal and |
This worked for me on Python 3.10 on Mac M1 minoforge3 environment.! Kudos to you! Before running this I made sure that all the packages are installed. No need to edit the vis_utils file! |
Great!!! worked for me. TNX |
This worked for me - I installed the packages as above, the pydotplus was missing for me. It works even with the file vis_utils edited. Then import the above package and "keras.utils.vis_utils.pydot = pydot" on my Jupiter notebook. Thank you @usmandroid |
Hi, I got the following error message (copied below) when I tried the code, although I do have both
pydot
andgraphviz
. I don't think this is an issue with your code. It seems to be a general long-standing issue withpydot
. The solutions are discussed here:1: Theano/Theano#1801
2: pydot/pydot#126
Traceback (most recent call last):
File "/Users/Qihong/anaconda/envs/brainiak/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 23, in _check_pydot
pydot.Dot.create(pydot.Dot())
File "/Users/Qihong/anaconda/envs/brainiak/lib/python3.6/site-packages/pydot_ng/init.py", line 1890, in create
'GraphViz's executables not found')
pydot_ng.InvocationException: GraphViz's executables not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "capsulenet.py", line 195, in
plot_model(model, to_file=args.save_dir+'/model.png', show_shapes=True)
File "/Users/Qihong/anaconda/envs/brainiak/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 131, in plot_model
dot = model_to_dot(model, show_shapes, show_layer_names, rankdir)
File "/Users/Qihong/anaconda/envs/brainiak/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 52, in model_to_dot
_check_pydot()
File "/Users/Qihong/anaconda/envs/brainiak/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 27, in _check_pydot
raise ImportError('Failed to import pydot. You must install pydot'
ImportError: Failed to import pydot. You must install pydot and graphviz for
pydotprint
to work.The text was updated successfully, but these errors were encountered: