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

ImportError: Failed to import pydot. Please install pydot. For example with pip install pydot. #69

Closed
lohitakshy opened this issue Aug 19, 2018 · 15 comments

Comments

@lohitakshy
Copy link

from keras.utils import plot_model
plot_model(model)

Showing this error.
ImportError: Failed to import pydot. Please install pydot. For example with pip install pydot.

  1. I installed --

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

@dominikburger
Copy link

dominikburger commented Aug 21, 2018

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:

  1. pydot
  2. pydotplus
  3. graphviz

For me, this has done the trick on both a Linux and Windows machine.

@XifengGuo
Copy link
Owner

@lohitakshy Please refer to #7

@sakshamjn
Copy link

i m having the same problem but the process of uninstalling and installing all the modules doesn't work for me plss help
prob

@anouar1991
Copy link

anouar1991 commented Mar 28, 2019

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)

@Hippyu
Copy link

Hippyu commented Apr 13, 2019

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.

@Elliott-Ruebush
Copy link

Elliott-Ruebush commented Apr 15, 2019

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:

  1. pydot
  2. pydotplus
  3. 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

@swun90
Copy link

swun90 commented Jul 27, 2019

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.

@Tarek98
Copy link

Tarek98 commented Nov 2, 2019

@swun90 This is what worked for me. Thank you :-)

@ghost
Copy link

ghost commented Dec 18, 2019

On Ubuntu 16.04, I try with:
sudo apt-get install python-pydot
and it worked ok.

@bowalesamuel
Copy link

@Hippyu it worked for me too 😫

@DebottamBasu
Copy link

@ghost this works perfectly

@ZNHU
Copy link

ZNHU commented Jun 29, 2020

My system is MAC, and I have the same problem.
Here's my solution:

import os
os.environ ['KMP_DUPLICATE_LIB_OK'] ='true'

@jmikedupont2
Copy link

without having to restart my notebook I did this

import keras.utils.vis_utils
from importlib import reload
reload(keras.utils.vis_utils)

@inspirepassion
Copy link

For those who wants to install pydot in their virtual environment on their Ubuntu machine, I did it by this:

  1. activate your virtual env, e.g., in terminal: conda activate name_of_env
  2. in termnial: python -m pip install pydot

you can check it out typing 'pip list' in terminal

@Shanmukh0028
Copy link

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

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