AppliedDataSciencePartners / DeepReinforcementLearning

A replica of the AlphaZero methodology for deep reinforcement learning in Python
GNU General Public License v3.0
2.02k stars 758 forks source link

ImportError: Failed to import `pydot #28

Open Vovak1919 opened 5 years ago

Vovak1919 commented 5 years ago

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 commented 5 years ago

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

Vovak1919 commented 5 years ago

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 commented 5 years ago

This helps

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

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.