12

My pip is not working anymore.

Here is the output for a sudo pip install pyjs :

  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 61, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
    from pip.download import path_to_url
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 25, in <module>
    from requests.compat import IncompleteRead
ImportError: cannot import name IncompleteRead

How can i repair this ? :(

17

this has been answered here.

But I will paste the answer as I don't have enough points to mark this a duplicate.

apt-get installs a much older version of pip which can lead to problems, completely remove python-pip with:

apt-get remove --purge python-pip

then:

curl https://bootstrap.pypa.io/get-pip.py | sudo python

using sudo if required

  • What if sudo python get-pip.py throws errors? :/ – Enrico Apr 29 '17 at 20:26
  • then you need to figure out what those errors mean. It's hard to say anything without seeing errors. – Josh Beauregard May 1 '17 at 12:54
  • 1
    You're goddamn right – A1Gard May 8 '18 at 7:30
3
    sudo apt install --reinstall python
    sudo apt purge python-pip
    wget https://bootstrap.pypa.io/get-pip.py
    sudo python get-pip.py

All problem done all of this problem result from /etc/pip.

  • Hi blackcat, I think you may have gotten cut off when writing your answer. Your explanation below the code you provided is unclear. Also, I'm not sure why it would be necessary to reinstall python, can you explain? Lastly, as Timo said in his comment, this question has been answered elsewhere before, and if you're going to post a new answer, you might as well include the information from other helpful answers. E.g. there is an alternate method for reinstallation of pip. You install python-setuptools with apt and then use easy_install to install pip – Hee Jin Apr 29 '18 at 16:53
  • actually, the code before there is my personal experience , the key feature is the 3rd row ,and the other answer didn't paste the right URL of wget ,so I correct it and paste all of my code there incase of others can't solve it ,that's all – blackcat May 26 '18 at 6:06
2

I got the same error. I did this and it worked!

sudo apt-get install --reinstall python2.7

This to reinstall python. Don't ever try to uninstall python ,it will crash your OS as part of Ubuntu is dependent on python.Then,

sudo apt-get purge python-pip

This is to remove pip.

 wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py

Installs pip..`

sudo python get-pip.py

Then,you can install packages using pip like

sudo pip install package-name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.