pydot.InvocationException: GraphViz's executables not found
Andrew Mclaughlin
I couldn't find any solution that is related to Ubuntu server.
I am going to use plot_model from keras.utils import plot_model to save the .png format of the model. However, the error occurs saying `GraphViz's executables not found. Full trace-back is here:
Traceback (most recent call last): File "/home/user/00_files/project/combined/kfold_loop.py", line 85, in <module> plot_model(combined_net(), to_file = 'kfold_loop.png') File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 133, in plot_model dot = model_to_dot(model, show_shapes, show_layer_names, rankdir) File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 55, in model_to_dot _check_pydot() File "/usr/local/lib/python3.5/dist-packages/keras/utils/vis_utils.py", line 26, in _check_pydot pydot.Dot.create(pydot.Dot()) File "/home/user/.local/lib/python3.5/site-packages/pydot/__init__.py", line 1951, in create 'GraphViz\'s executables not found' )
pydot.InvocationException: GraphViz's executables not found
Process finished with exit code 1I have 0.13.2 version of graphviz and 1.4.1 version of pydoton Ubuntu 16.04 server.
What else should be done?
FYI: I am accessing Ubuntu server via PyCharm on Windows 10.
81 Answer
it seems that you are mistaking the python graphviz package () with the graphviz app (). In order to use pydot or graphviz (the python package) you need a working copy of graphviz (the app).
If you doesn't have access to sudo, there are two ways that i could think of
- Use conda (recommended)
- Compile graphviz manually
However in order to compile graphviz manually without sudo access is really hard because of the many dependencies required. Because of that, I recommend you to use conda.
Conda step by step:
- Download miniconda ()
- Install miniconda by running the downloaded script
- Create a new environment
conda create -n env_name python=3.5 - Install graphviz (the app)
conda install -n env_name graphviz - Activate the conda environment
conda activate env_name - Install your other python dependencies using pip
edit
For installing conda environment on an offline machine, you can install conda env locally on your dev machine and then move it to the server using conda pack
- Install the environment locally (on a similar operating system)
- Install conda pack on the local machine
pip install conda-pack - Package the environment
conda pack -n env_name - Copy the created
env_name.tar.gzto the server - Extract the archive to a new folder (e.g. env_name)
- To activate the environment run
source env_name/bin/activate