ImportError: No module named pydot ( unable to import pydot)
Asked Answered
C

4

18

I am unable to import the pydot package in Spyder, Could you please help me out is there any other way to import it. I need it for decision tree visualization. The statement

import pydot

is not working.

Cyclopean answered 3/2, 2016 at 12:34 Comment(0)
O
24
pip install pydot
pip install graphviz

there is a similar problemm: Keras: "RuntimeError: Failed to import pydot." after installing graphviz and pydot

pip installs pydot, but not GraphViz. The GraphViz binary files (dot, neato, etc.) need to be downloaded and installed separately from pydot. In addition, the location of these executables should be added to the $PATH environment variable (or equivalent in your operating system). Otherwise pydot won't find dot when looking in directories included in the current path.

Ornis answered 28/3, 2017 at 8:10 Comment(1)
the bin file includes the following exe:dot.exe, twopi.exe, neato.exe,Ornis
V
5

Do you not know how to install pydot in python spyder? If you use Spyder on Windows, you could try to input code following in CMD( I have no idea whether it is effective on Linux):

conda install -c https://conda.binstar.org/sstromberg pydot

If it says 'InvocationException: GraphViz's executables not found' after you install pydot, you need install GraphViz as well:

conda install GraphViz
Vander answered 1/5, 2016 at 8:46 Comment(2)
if you not sure then don't put it as a answerCumings
Sorry, I am NOT "not sure". I am just not fully understand what is @Sanchit Aluna 's problem and the context the error happened. I think my answer will be helpful:)Vander
S
2

Try to command line with:

import pydot

If you get ImportError, just reinstall this module.

Maybe you have multiple installations of Python (e.g. 2.7 and 3.5). When installing you put the module in one Python and try to import in another.

Also, this problem can to occur due to the fact that instead install you just copied the file to your local directory. If yes, use pip or setuptools for install or add your local directory to sys.path.

Scyros answered 3/2, 2016 at 12:37 Comment(7)
Hi, If i comment the import pydot then how will it work. i have python in my computer that is the language i am using for importing pydot. it is not working . could you please elaborate what were you trying to say?Cyclopean
I have just 2.7 and how can i put in one and import in another. as i am new to python i am just giving 'import pydot' command in python nothing else.Cyclopean
Thanks for the suggestion but your suggestion could not help me out . Any other suggestion how to import pydot package in Python. i just i have to write import pydot apart from this i do not know any other procedure. Please suggestCyclopean
@SanchitAluna It looks like you have not properly installed pydot. JRazor is suggesting that you reinstall.Acton
Hi @Acton can you suggest me how do i reinstall as i am again typing only 'import pydot' is there any other words i have to type to reinstallCyclopean
@SanchitAluna I don't mean import. I mean the pydot package is not on your computer. Therefore Python doesn't know where to find it. I would guess that you could install pydot by running sudo pip install pydot from the command-line, (not the Python shell).Acton
Thankyou @Zondo and JRazor for the help. it works now, i have installed it from pip :)Cyclopean
N
2

You could install pydot and pyparsing using conda.

conda install -c anaconda pydot=1.2.3
conda install -c anaconda pyparsing=2.2.0
Norse answered 13/6, 2017 at 22:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.