8

I tried installing/uninstalling pyparsing as well and it does not work. I am stuck with this and I have to install additional libraries as well.

Here is the error message:

Traceback (most recent call last): 
File "/usr/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
File "/home/rachana/.local/lib/python2.7/site-packages/pkg_resour‌​ces/__init__.py", line 72, in <module>
    import packaging.requirements
File "/home/rachana/.local/lib/python2.7/site-packages/packaging/‌​requirements.py", line 9, in <module>
    from pyparsing import stringStart, stringEnd, originalTextFor, ParseException
ImportError: No module named pyparsing

How can I fix this?

Floern
  • 33,559
  • 24
  • 104
  • 119
rachana_sharma003
  • 127
  • 1
  • 2
  • 8
  • `easy_install pyparsing`? – ForceBru Feb 11 '17 at 20:53
  • Its not working still ! tried all possibilites – rachana_sharma003 Feb 11 '17 at 20:57
  • Please include the _exact_ error messages in your question – ForceBru Feb 11 '17 at 20:58
  • Traceback (most recent call last): File "/usr/bin/pip", line 5, in from pkg_resources import load_entry_point File "/home/rachana/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 72, in import packaging.requirements File "/home/rachana/.local/lib/python2.7/site-packages/packaging/requirements.py", line 9, in from pyparsing import stringStart, stringEnd, originalTextFor, ParseException ImportError: No module named pyparsing – rachana_sharma003 Feb 11 '17 at 21:01
  • What does `easy_install pyparsing` return? – ForceBru Feb 11 '17 at 21:03
  • Traceback (most recent call last): File "/usr/bin/easy_install", line 5, in from pkg_resources import load_entry_point File "/home/rachana/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 72, in import packaging.requirements File "/home/rachana/.local/lib/python2.7/site-packages/packaging/requirements.py", line 9, in from pyparsing import stringStart, stringEnd, originalTextFor, ParseException ImportError: No module named pyparsing – rachana_sharma003 Feb 11 '17 at 21:04
  • The same error. – rachana_sharma003 Feb 11 '17 at 21:05
  • Then you'll need to [install](http://pyparsing.wikispaces.com/Download+and+Installation) `pyparsing` manually. – ForceBru Feb 11 '17 at 21:09
  • Got it thank you very much – rachana_sharma003 Feb 11 '17 at 21:11
  • Have you tried installing it _from source_, as shown in the 'Installing' section? – ForceBru Feb 11 '17 at 21:13
  • Yeah downloaded the zip file and ran the same – rachana_sharma003 Feb 11 '17 at 21:15
  • In case that doesn't work, read [harshvchawla's suggestion](http://stackoverflow.com/a/42897868/7812406). It worked for me! – Chege Apr 04 '17 at 06:25

3 Answers3

19

I'm had the same problem and resolved it. Here is you can see that pip not working properly (without any additional parameters).

root@notebook:/home/ci# pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 72, in <module>
    import packaging.requirements
  File "/usr/local/lib/python2.7/dist-packages/packaging/requirements.py", line 9, in <module>
    from pyparsing import stringStart, stringEnd, originalTextFor, ParseException

Okay, so first that we may do is installing broken dependency:

wget https://pypi.python.org/packages/3c/ec/a94f8cf7274ea60b5413df054f82a8980523efd712ec55a59e7c3357cf7c/pyparsing-2.2.0.tar.gz
gunzip pyparsing-2.2.0.tar.gz
tar -xvf pyparsing-2.2.0.tar
cd pyparsing-2.2.0 && python setup.py install

After it mising dependency will be installed from sources.

Trying to using pip one more time:

root@rundeck.euovh01.un.private:/tmp/pyparsing-2.2.0# pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 74, in <module>
    import appdirs
ImportError: No module named appdirs

This is the next problem. And you can fix it more quickly:

root@notebook:/home/ci# python -m pip install appdirs
Downloading/unpacking appdirs
  Downloading appdirs-1.4.3-py2.py3-none-any.whl
Installing collected packages: appdirs
Successfully installed appdirs
Cleaning up...

After that my pip was successfully repaired. Kind regards.

Zhang Yiwei
  • 303
  • 3
  • 5
  • 1
    Thanks! You're a life saver. I had to run the install commands with `sudo`, the otherwise this solution worked perfectly. – OLL Mar 23 '17 at 11:49
  • awesome! do you know what caused this error in the first place? – d00d Mar 27 '17 at 00:00
2

Similar to @Oleg Mykolaichenko answer, but using pip:

[sudo] pip install pyparsing

[sudo] pip install appdirs
Community
  • 1
  • 1
Ittiel
  • 1,104
  • 9
  • 12
  • 2
    This did not work. The problem is that `pip` is broken because `pyparsing` is missing, so running `pip install pyparsing` will just produce the same `ImportError: No module named pyparsing` error. – OLL Mar 23 '17 at 11:48
0

ah! I was stuck with for an hour and found this out

pip3 install pyparsing
Code Tree
  • 2,160
  • 4
  • 26
  • 39