Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib requires pyparsing

I am trying to plot some data using matplotlib. When importing the library, I get the error:

ImportError: matplotlib requires pyparsing

I installed pyparsing using easy_install pyparsing, but the error keeps appearing.

How can I solve this problem? Alternatively, is there any alternative to matplotlib to plot stuff with Python?

Edit: sys.path returns:

['', 'C:\\Python27\\lib\\site-packages\\spyderlib\\utils\\external', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\lib\\site-packages\\Orange\\orng', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Python27\\lib\\site-packages\\win32', 'C:\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\Python27\\lib\\site-packages\\IPython\\extensions']

Trying to import pyparsing returns the error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 540, in runfile
    execfile(filename, namespace)
  File "C:/Python27/Lib/site-packages/xy/simulation.py", line 4, in <module>
    import pyparsing
ImportError: No module named pyparsing
like image 969
Daniel Robert-Nicoud Avatar asked Mar 01 '14 16:03

Daniel Robert-Nicoud


4 Answers

For me, a previous egg installation screwed things. I just did:

pip uninstall pyparsing
pip install pyparsing

And that fixed the dependency resolution.

like image 52
ceztko Avatar answered Oct 03 '22 00:10

ceztko


pip install pyparsing

was NOT working for me. pyparsing must come with python. Reinstalling the python and pip worked for me.

like image 22
Bethleharaja G Avatar answered Oct 03 '22 01:10

Bethleharaja G


For what it's worth you could also try installing via pip if you have it. Quick link if you need an install script: Stackoverflow post. Anyways, then just use:

pip install pyparsing
like image 31
JDGD Avatar answered Oct 03 '22 00:10

JDGD


apt-get remove python-pip
apt-get install build-essential libssl-dev libffi-dev python-dev
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
apt-get install python-pip
pip install cffi

These steps resolved the basic "pip --version" errors

like image 42
gawkface Avatar answered Oct 02 '22 23:10

gawkface