Recently upgraded to Arc 10.2.2...no issues during installation. I have been using Pythonwin and Pyscripter with no issues at all until I went to re-examine some graphing examples that I had tested previously this summer with no issues...or so I thought. The code snippet below fails in both programs yielding the error:
Message File Name Line Position
Traceback
<module> C:\!AV_10\PythonDemos\PyLab\pylabLineGraphDemo2.py 14
<module> C:\Python27\ArcGIS10.2\lib\site-packages\pylab.py 1
<module> C:\Python27\ArcGIS10.2\lib\site-packages\matplotlib\__init__.py 121
ImportError: matplotlib requires pyparsing >= 1.5.6
Since I have been known to be crazy, could someone test the code snippet on a version of Pythonwin and/or Pyscripter for a pre-10.2.2 installation? (Note: People copying and pasting code will still have the line numbers if using IE 11...this is a known issue)
EDIT Could someone also test it on 10.2.2 to see if it is just my installation that has gone bad or if it is general in nature.
Thanks
''' import numpy import numpy.random import pylab #data examples, uncomment as desired #xs = numpy.random.randint(0,100, 25); ys = numpy.random.randint(0,100, 25) #random integers #xs = [0,1,2,3,4,5,6,7,8,9,10]; ys = [0,1,2,3,4,5,6,7,8,9,10] #sequential integers xs = [0,1,2,3,4,5,6,7,8,9,10]; ys = [0.1,0.9,2.1,2.9,4.1,5,5.9,7.1,7.9,9.1,10] #sequential with scatter pylab.scatter(xs, ys,s=20, c='b', marker='+') #blue + markers pylab.title("Sample title") pylab.xlabel("x-axis") pylab.ylabel("y-axis") pylab.text(1,10,"Sample text") fit = pylab.polyfit(xs,ys,1) fit_fn = pylab.poly1d(fit) #plot with blue pluses (b+), solid black line -, try yo yellow circles (yo) dashed line (--k) pylab.plot(xs, ys, 'b+', xs, fit_fn(xs), '-k') pylab.show()
Message was edited by: Dan Patterson Widen audience
Message was edited by: Dan Patterson broaden scope
Dan,
It worked fine on my ArcGIS 10.1 machine.
Thanks Robert for the test and confirmation of my sanity.
Hi Dan,
It works perfectly for me (only tried the sequential with scatter graph). I am using 10.2.2.3552 (Advanced).
Hope you figure it out (I can't think of a reason why it doesn't work at your machine).
Kind regards, Xander
Thanks Xander
Great (not)...How can a flawless installation become flawed . I guess an uninstall and reinstall is in order
Did you install any other python libraries after installing ArcGIS 10.2.2? Might be some conflict?
...I just installed pyscripter for python 2.7 after ArcGIS was installed !? (who knows)
...but I have found a workaround which I am still testing and it works. pyparser is installed in two directories in my installation ....
c:\python27\ArcGIS10.2\site-packages\pyparsing.py and...
c:\python27\ArcGIS10.2\site-packages\matplotlib\pyparsing.py
both are the same installation date and for python 2.7
I find this strange, but I have two workarounds, both of which I don't like because I prefer not to use the...
>>>from somemodule import *
but prefer to use the syntax... somemodule.something when coding i.e.
import pylab
pylab.title("Sample title")
yet pylab is part of matplotlib which I didn't import directly.
So when I am done tinkering and checking on whether the installation is OK, I will report back.
Yes please do report back, since you might not be the only one that will face that problem.
Thanks and good luck!
Xander
Sorry for the late reply...I gave up on tracking down the error so I was forced to change my import statements to:
import arcpy
import numpy as np
from matplotlib import pyparsing
from matplotlib import pyplot as plt
and institute the import...as and from...import as syntax for clarity. This line in particular:
from matplotlib import pyparsing
was needed to alleviate the pyparsing error, and it doesn't hurt anyway.
I will leave the question open in case someone stumbles on it and finds a real solution, in the interim, thanks for the helpful comments.
No updates since my last post, I will still leave this open until such time as a get a brand new machine and install everything from scratch to see if the issue persists or my experience and workaround was a one-off solution. Comments were much appreciated