21

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 ? :(

bob dylan
  • 371
  • 2
  • 3
  • 9
  • Whats the output of `pip -V` ? – heemayl Jun 30 '15 at 09:12
  • `ImportError: No module named site` – bob dylan Jun 30 '15 at 11:10
  • reinstall `pip`: `sudo apt-get install --reinstall python-pip` – heemayl Jun 30 '15 at 11:11
  • 3
    This is a known issue with the default version of pip in Ubuntu 14.04 and an updated `requests` package. Duplicate of http://askubuntu.com/questions/561377/pip-wont-run-throws-errors-instead Some Launchpad report https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1306991 and a SO question http://stackoverflow.com/questions/27341064/how-do-i-fix-importerror-cannot-import-name-incompleteread They all give multiple ways to fix this. – Timo Jun 30 '15 at 11:46

3 Answers3

26

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

Josh Beauregard
  • 361
  • 3
  • 7
6
    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.

Kevin Bowen
  • 19,395
  • 55
  • 76
  • 81
blackcat
  • 61
  • 1
  • 2
  • 1
    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 06: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
Sivagami Nambi
  • 221
  • 1
  • 6