Why does `tensorflow.keras.utils.plot_model()` fail even though I have installed 'pydot' and 'graphviz'?

Viewed 382

I'm following the documentation and trying to plot the architecture of my MLP with tensorflow.keras.utils.plot_model(). However, it keeps returning

('Failed to import pydot. You must `pip install pydot` and install graphviz (https://graphviz.gitlab.io/download/), ', 'for `pydotprint` to work.')

even though I specifically check and both pydot and graphviz have been listed in the installed packages. Why is this happening? What should I do to fix it?


P.S

pip install pydot
pip install pydotplus
pip install graphviz

pip list

I have run the above and checked that the 3 packages, pydot, pydotplus, and graphviz are indeed in the list of installed packages. Nonetheless, calling tensorflow.keras.utils.plot_model() returns the same error. I also tried downloading a .tar.gz file from https://graphviz.gitlab.io/download/ and running

PS C:\Users\pawindata\Downloads> pip install graphviz-2.44.1.tar.gz

and

PS D:\Python\Scripts> pip install C:\Users\pawindata\graphviz.-2.44.1.tar.gz

It only returns something I don't know how to read properly.

    ERROR: Command errored out with exit status 1:
     command: 'd:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\pawindata\\AppData\\Local\\Temp\\pip-req-build-mumd1dhq\\setup.py'"'"'; __file__='"'"'C:\\Users\\pawindata\\AppData\\Local\\Temp\\pip-req-build-mumd1dhq\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\pawindata\AppData\Local\Temp\pip-pip-egg-info-w1om_ysn'
         cwd: C:\Users\pawindata\AppData\Local\Temp\pip-req-build-mumd1dhq\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "d:\python\lib\tokenize.py", line 392, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\pawindata\\AppData\\Local\\Temp\\pip-req-build-mumd1dhq\\setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
0 Answers
Related