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 #28

Open
Vovak1919 opened this issue Dec 3, 2018 · 4 comments
Open

ImportError: Failed to import `pydot #28

Vovak1919 opened this issue Dec 3, 2018 · 4 comments

Comments

@Vovak1919
Copy link

Vovak1919 commented Dec 3, 2018

When I open run.ipynb in jupiter, in block 2 (In: 2) I have a message:


ImportError Traceback (most recent call last)
in
39 #copy the config file to the run folder
40 copyfile('./config.py', run_folder + 'config.py')
---> 41 plot_model(current_NN.model, to_file=run_folder + 'models/model.png', show_shapes = True)
42
43 print('\n')

c:\users\вова\appdata\local\programs\python\python36\lib\site-packages\keras\utils\vis_utils.py in plot_model(model, to_file, show_shapes, show_layer_names, rankdir)
130 'LR' creates a horizontal plot.
131 """
--> 132 dot = model_to_dot(model, show_shapes, show_layer_names, rankdir)
133 _, extension = os.path.splitext(to_file)
134 if not extension:

c:\users\вова\appdata\local\programs\python\python36\lib\site-packages\keras\utils\vis_utils.py in model_to_dot(model, show_shapes, show_layer_names, rankdir)
53 from ..models import Sequential
54
---> 55 _check_pydot()
56 dot = pydot.Dot()
57 dot.set('rankdir', rankdir)

c:\users\вова\appdata\local\programs\python\python36\lib\site-packages\keras\utils\vis_utils.py in _check_pydot()
18 if pydot is None:
19 raise ImportError(
---> 20 'Failed to import pydot. '
21 'Please install pydot. '
22 'For example with pip install pydot.')

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

Reinstalling keras and pydot on the required versions does not solve the problem

@acautin
Copy link

acautin commented Dec 6, 2018

I had a similar issue, had to install pydot-ng as well, did you installed everything using the requirements file ?

@Vovak1919
Copy link
Author

No, I just commented out the line with the code:
plot_model(current_NN.model, to_file=run_folder + 'models/model.png', show_shapes = True)

@Vovak1919
Copy link
Author

This helps

import os
os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/'

@archcra
Copy link

archcra commented Dec 17, 2018

I resolved this error(in docker container) with the following commands:

apt-get update
apt-get install python-pydot python-pydot-ng graphviz
pip install --upgrade pip
pip install pydot graphviz 

Hope this help.

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

3 participants