Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError: [Errno 2] "dot" not found in path #257

Open
sys-walker opened this issue Mar 2, 2021 · 7 comments
Open

FileNotFoundError: [Errno 2] "dot" not found in path #257

sys-walker opened this issue Mar 2, 2021 · 7 comments

Comments

@sys-walker
Copy link

Description

I tried to use pydot to plot a decision tree but i got this error, i will provide the code used in order to reproduce that situation Main.py

$ /home/sys-walker/Documentos/PyCharmProjects/PlotDesicionTree/venv/bin/python /home/sys-walker/Documentos/PyCharmProjects/PlotDesicionTree/Main.py

Traceback (most recent call last):
  File "/home/sys-walker/Documentos/PyCharmProjects/PlotDesicionTree/Main.py", line 34, in <module>
    graph.write_png('example1_graph.png')
  File "/home/sys-walker/Documentos/PyCharmProjects/PlotDesicionTree/venv/lib/python3.8/site-packages/pydot.py", line 1743, in new_method
    self.write(
  File "/home/sys-walker/Documentos/PyCharmProjects/PlotDesicionTree/venv/lib/python3.8/site-packages/pydot.py", line 1828, in write
    s = self.create(prog, format, encoding=encoding)
  File "/home/sys-walker/Documentos/PyCharmProjects/PlotDesicionTree/venv/lib/python3.8/site-packages/pydot.py", line 1933, in create
    raise OSError(*args)
FileNotFoundError: [Errno 2] "dot" not found in path.
        ^

Time: 0.002s
sys-walker@(none):sys-walker>

Environment used

  • OS and python version information.
$  cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal


(venv) sys-walker@sys-walker:~/Documentos/PyCharmProjects/PlotDesicionTree$ python --version
Python 3.8.5

  • Pydot version used.
pydot version 1.4.2
  • Output of pip freeze command.
$ pip3 freeze
pkg-resources==0.0.0
pydot==1.4.2
pyparsing==2.4.7
@peternowee
Copy link
Member

Do you have Graphviz installed? What is the output of running dot -V from the command line?

@sys-walker
Copy link
Author

It was this.I did have not install Graphviz, thanks a lot

@peternowee
Copy link
Member

No problem, maybe we should see if we can make the error message more clear. Thanks, all the best!

@peternowee
Copy link
Member

Should be solved as part of #218. That PR is currently closed, but I hope to reopen it in the future.

@etienne-sf
Copy link

etienne-sf commented Apr 26, 2021

Hello,

Yes, it would be nice to have a clear error message.
:As an addition, it would also be nice that the README states more clearly (that is: at the beginning) that graphviz needs to be installed. It's written in the Dependencies part, at the very end of this README. So this strange error comes once pydot is installed, and while doing a first trial.
(as a wish: it could be automatically downloaded by pydot...)

Etienne

NB: in the meanwhile, please let this issue open! At least, we know what to do with this error. And now, I can generate graphviz schema from Python, which is nice! :)

@mainguyenanhvu
Copy link

mainguyenanhvu commented Oct 18, 2023

I faced the same error. I can't run dot -V. Please show me the way to fix it. Thank you very much.

My pip install:

pip freeze
graphviz==0.20.1
pydot==1.4.2
pyparsing==3.1.1

Update:
I have to install by using sudo:

sudo apt-get install graphviz

However, if I do not have sudo permission, please help me to solve it.

@mainguyenanhvu
Copy link

@sys-walker: Is the problem solved by using conda https://anaconda.org/conda-forge/graphviz?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants