Closed lohitakshy closed 6 years ago
In addition to pydot and graphviz install pydotplus. This should solve your problem.
Edit: I overlooked that you already installed pydotplus, my bad. Try uninstalling all pydot related modules and graphiviz, then reinstall in the following order:
For me, this has done the trick on both a Linux and Windows machine.
@lohitakshy Please refer to https://github.com/XifengGuo/CapsNet-Keras/issues/7
i m having the same problem but the process of uninstalling and installing all the modules doesn't work for me plss help
Try this :)
import keras
import pydot as pyd
from IPython.display import SVG
from keras.utils.vis_utils import model_to_dot
keras.utils.vis_utils.pydot = pyd
#Visualize Model
def visualize_model(model):
return SVG(model_to_dot(model).create(prog='dot', format='svg'))
#create your model
#then call the function on your model
visualize_model(model)
Just like @anouar1991 said.
What I did are followed:
import keras
import pydotplus
from keras.utils.vis_utils import model_to_dot
keras.utils.vis_utils.pydot = pydot
plot_model(autoencoder, to_file='model.png')
That's worked for me.
In addition to pydot and graphviz install pydotplus. This should solve your problem.
Edit: I overlooked that you already installed pydotplus, my bad. Try uninstalling all pydot related modules and graphiviz, then reinstall in the following order:
- pydot
- pydotplus
- graphviz
For me, this has done the trick on both a Linux and Windows machine.
I followed the advice of uninstalling and reinstalling pydot + pydotplus and that successfully solved the issue on my Windows 10 machine using Anaconda 3.
conda uninstall pydot
conda uninstall pydotplus
conda uninstall graphviz
then
conda install pydot
conda install pydotplus
Note: installing pydot also installed graphviz
In windows system, also install graphviz software. And add the software bin directory to the system's path.
And in class Dot(Graph)
, change self.prog = 'dot'
to
self.prog = 'dot.exe'
Seems that the package was written for *nix system. So in windows, assign it to be an .exe file
.
@swun90 This is what worked for me. Thank you :-)
On Ubuntu 16.04, I try with: sudo apt-get install python-pydot and it worked ok.
@Hippyu it worked for me too 😫
@ghost this works perfectly
My system is MAC, and I have the same problem. Here's my solution:
import os os.environ ['KMP_DUPLICATE_LIB_OK'] ='true'
without having to restart my notebook I did this
import keras.utils.vis_utils
from importlib import reload
reload(keras.utils.vis_utils)
For those who wants to install pydot in their virtual environment on their Ubuntu machine, I did it by this:
you can check it out typing 'pip list' in terminal
without having to restart my notebook I did this
import keras.utils.vis_utils from importlib import reload reload(keras.utils.vis_utils)
@jmikedupont2 thanks it worked after a struggle of 1 hr I found this worked for me
from keras.utils import plot_model plot_model(model)
Showing this error. ImportError: Failed to import
pydot
. Please installpydot
. For example withpip install pydot
.(base) C:\Users\lohit>pip install pydot Requirement already satisfied: pydot in c:\users\lohit\anaconda3\lib\site-packages (1.2.4) Requirement already satisfied: pyparsing>=2.1.4 in c:\users\lohit\anaconda3\lib\site-packages (from pydot) (2.2.0)
(base) C:\Users\lohit>pip install pydotplus Requirement already satisfied: pydotplus in c:\users\lohit\anaconda3\lib\site-packages (2.0.2) Requirement already satisfied: pyparsing>=2.0.1 in c:\users\lohit\anaconda3\lib\site-packages (from pydotplus) (2.2.0)
(base) C:\Users\lohit>pip install pydot_ng Requirement already satisfied: pydot_ng in c:\users\lohit\anaconda3\lib\site-packages (1.0.0) Requirement already satisfied: pyparsing>=2.0.1 in c:\users\lohit\anaconda3\lib\site-packages (from pydot_ng) (2.2.0)
(base) C:\Users\lohit>pip install graphviz Requirement already satisfied: graphviz in c:\users\lohit\anaconda3\lib\site-packages (0.9)
Still, it's showing an error? Kindly help me with this issues.