Skip to content Skip to sidebar Skip to footer

Nameerror: Global Name 'dot_parser' Is Not Defined

I was playing with the decision tree algorithm and trying to plot the tree. However the IDE reported following error: Couldn't import dot_parser, loading of dot files will not be p

Solution 1:

It seems your error is that you are missing part of a library (pyparsing) because of incorrect order of installation.

See here and here

Obvious to the initiated but not to the newbie: The workaround is to install pyparsing < 2.0.0 prior to installing pydot (or a package that depends on pydot.)

$ pip install pyparsing==1.5.7

The solution seems to be to first remove pydot and pyparsing, and then to install pyparsing first, then pydot.

The versions of which to install will most likely change in the future, so at the moment it seems you need to run something like the following: (taken from this lovely answer)

pip uninstall pyparsing
pip install -Iv https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz#md5=9be0fcdcc595199c646ab317c1d9a709
pip install pydot

Solution 2:

For me, I found a great tip is to install pydotplus instead, as it is compatible with pyparsing v2.0 and greater. It also has the advantage that it can work with the graphviz installation from Anaconda. I'm using Anaconda v2.4.1 and on Windows 7 x64 and Graphviz 2.38 installed using condas.

Solution 3:

I've just update my pydotto 1.2.3, and the error disappears.

sudo pip install -U pydot

Post a Comment for "Nameerror: Global Name 'dot_parser' Is Not Defined"