When I do pip --version, it shows an error as ImportError: there is no module named pyparsing

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

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?

+8
source share
3 answers

I had the same problem and it was resolved. Here you see that the pip is 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 

So, first we can establish a 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 this dependence will be established from sources.

Trying to use pip again:

 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 faster:

 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. Sincerely.

+19
source

Like @Oleg Mykolaichenko answer , but using pip:

 [sudo] pip install pyparsing [sudo] pip install appdirs 
0
source

Oh! I got stuck for an hour and figured it out

 pip3 install pyparsing 
0
source

Source: https://habr.com/ru/post/1014907/


All Articles