Skip to content

ImportError: Failed to import `pydot #28

Open

Description

@Vovak1919

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

Activity

  1. acautin commented on Dec 6, 2018

    @acautin

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

  2. Vovak1919 commented on Dec 7, 2018

    @Vovak1919
    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)

  3. Vovak1919 commented on Dec 7, 2018

    @Vovak1919
    Author

    This helps

    import os
    os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/'
    
  4. archcra commented on Dec 17, 2018

    @archcra

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions