
[英]pydot.InvocationException: GraphViz's executables not found
[英]`pydot` failed to call GraphViz.Please install GraphViz and ensure that its executables are in the $PATH
我的 jupyter 服务器在 gcp 深度学习虚拟机中运行。
我正在尝试在 Jupyter 笔记本单元中打印模型。
import os, sys
from utils.models.alexnet import alexnet
from keras.utils.vis_utils import plot_model
from keras.optimizers import SGD
model = alexnet(len(class_names))
model.summary()
plot_model(model, to_file="alexnet_model.png", show_shapes=True)
我收到这个错误
`pydot` failed to call GraphViz.Please install GraphViz ([https://www.graphviz.org/](https://www.graphviz.org/)) and ensure that its executables are in the $PATH.
我已经在我的机器上正确安装了 Graphviz
apt-get install graphviz
stat /usr/bin/dot
File: /usr/bin/dot
Size: 10568 Blocks: 24 IO Block: 4096 regular file
Device: 801h/2049d Inode: 142872 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2020-02-10 11:48:19.416617639 +0000
Modify: 2017-02-19 10:32:17.000000000 +0000
Change: 2019-12-13 01:47:41.084977709 +0000
还安装了 python 包 pydot、pydot-ng、pydotplus。
这是我的路径变量
echo $PATH
/usr/local/cuda/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
/user/bin
包含在这里。
编辑
在 jupyter notebook shell 中执行时。
print(os.environ["PATH"])
/usr/local/cuda/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
另一个奇怪的事情
我有一个简单的图像数据集,包含 3 个类,总共大约 2000 个图像。 在我的 jupyter notebook 中,我首先处理图像并将其加载到内存中。 接下来是创建模型并打印它。 使用简单的数据集,它可以正常工作。 当我处理大型数据集时会发生这种情况。
我也得到了同样的东西,所以我在 conda install pydot 之后安装了 conda install python-graphviz
我有同样的问题,我按照Prerna Verma的回答解决了它。 顺便说一下,在 Linux Envs 中使用 graphviz 需要三个步骤:
sudo apt-get install graphviz
(如果您是 Windows 用户,请下载并安装 graphviz )
conda install pydot
conda install python-graphviz
然后,你可以使用它!
conda
仅安装graphviz
二进制文件,但您还需要安装 Python 依赖项。 所以安装它们:
conda install graphviz
conda install python-graphviz
这为我解决了这个问题:
sudo apt install python-pydot python-pydot-ng graphviz
参考问题: https : //github.com/WillKoehrsen/Data-Analysis/issues/36
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.