pip stops with ImportError for request-Modul

Bug #1306991 reported by Jochen Schnelle
420
This bug affects 98 people
Affects Status Importance Assigned to Milestone
python-pip (Debian)
Fix Released
Unknown
python-pip (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

After upgrading from 13.10 -> 14.04 (Beta 1, upgrade date Apr 12th, 2014), all calls for pip end with the following error:

jochen@tp-r61:~$ sudo pip freeze
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 352, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 2307, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 2021, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 11, 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

Same for e.g. pip install etc.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pip (Ubuntu):
status: New → Confirmed
Revision history for this message
Nickv2002 (nickv2002) wrote :

Same on the 14.04 regular release today. Tried to to purge and re-install pip but still got the same error.

Revision history for this message
deftoner (n-b-s) wrote :

Hello there! thanks for your time.

I got same error, on clean instalation ubuntu 14. 04.

I installed:
apt-get -y install python-svn ipython python-pip python-dev couchdb libpq-dev

eftoner@ubuntu:~/pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 351, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2363, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2088, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 11, 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

Thanks!

Revision history for this message
James Smith (2-james-q) wrote :

Exact same message as deftoner here.

Revision history for this message
James Smith (2-james-q) wrote :

Workaround (assuming pip is installed):

    mv /usr/bin/pip /usr/bin/broken-pip.bak
    ln -s /usr/bin/pip3 /usr/bin/pip

Revision history for this message
mamunabms (mamunabms) wrote :

pip is working fine in virtualenv.
probably shipped python-requests package is buggy.

In virtualend I'm getting
requests.__version__
'2.2.1'

In system python
 requests.__version__
'1.1.0'

can't figure out why?

Revision history for this message
Johan Lundahl (yohan-lundahl) wrote :

Workaround (instead of installing python-pip via apt-get):

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

Revision history for this message
Chris Doehring (chrisdoehring) wrote :

I resolved it with Johan's advice, after removing python-pip.

Ex.
sudo apt-get remove python-pip
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py

affects: pip (Ubuntu) → python-pip (Ubuntu)
Changed in python-pip (Debian):
status: Unknown → New
Revision history for this message
mlissner (mlissner-michaeljaylissner) wrote :

In reply to comment #6, I'm fairly certain this isn't requests' fault. My practice for one of my libraries for a long time was to lock the requests version at 1.2.3. Until Ubuntu 14.04, that worked fine, and the version was great.

This time immediately after I installed my older version of requests, pip started throwing this error.

Here's my terminal log. You can see everything is all good *until* I install requests.

10:54:26::mlissner@pounamu::~/Programming/intellij/juriscraper
↪ sudo pip install chardet==1.0.1
Downloading/unpacking chardet==1.0.1
  Downloading chardet-1.0.1.tar.gz (156kB): 156kB downloaded
  Running setup.py (path:/tmp/pip_build_root/chardet/setup.py) egg_info for package chardet

Installing collected packages: chardet
  Found existing installation: chardet 2.0.1
    Uninstalling chardet:
      Successfully uninstalled chardet
  Running setup.py install for chardet

Successfully installed chardet
Cleaning up...
10:54:36::mlissner@pounamu::~/Programming/intellij/juriscraper
↪ sudo pip install requests==1.2.3
Downloading/unpacking requests==1.2.3
  Downloading requests-1.2.3.tar.gz (348kB): 348kB downloaded
  Running setup.py (path:/tmp/pip_build_root/requests/setup.py) egg_info for package requests

Installing collected packages: requests
  Found existing installation: requests 2.2.1
    Uninstalling requests:
      Successfully uninstalled requests
  Running setup.py install for requests

Successfully installed requests
Cleaning up...
10:54:43::mlissner@pounamu::~/Programming/intellij/juriscraper
↪ sudo pip install lxml==3.0.1
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 351, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2363, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2088, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 11, 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

Revision history for this message
mlissner (mlissner-michaeljaylissner) wrote :

And here's my solution. Basically, I move the installed version of requests aside then reinstall the version that I had using easy_install (since pip is borked). Once that's done, you can see that it works again. Note that you can't just install requests without telling it a version because it might install from pip's cache, which would just install the old version of requests again.

11:07:08::mlissner@pounamu::/usr/lib/python2.7/dist-packages
↪ sudo mv requests/ requests.old

11:07:42::mlissner@pounamu::/usr/lib/python2.7/dist-packages
↪ sudo easy_install requests==2.2.1
Searching for requests==2.2.1
Reading https://pypi.python.org/simple/requests/
Best match: requests 2.2.1
Downloading https://pypi.python.org/packages/source/r/requests/requests-2.2.1.tar.gz#md5=ac27081135f58d1a43e4fb38258d6f4e
Processing requests-2.2.1.tar.gz
Writing /tmp/easy_install-JEvkCb/requests-2.2.1/setup.cfg
Running requests-2.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-JEvkCb/requests-2.2.1/egg-dist-tmp-ybDF6A
Adding requests 2.2.1 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/requests-2.2.1-py2.7.egg
Processing dependencies for requests==2.2.1
Finished processing dependencies for requests==2.2.1

Revision history for this message
Jeff Zellner (jeffz-g) wrote :

I can also confirm this is broken for me, and that installing requests==2.2.1 via easy_install fixes the problem.

Changed in python-pip (Ubuntu):
status: Confirmed → Opinion
status: Opinion → Confirmed
Revision history for this message
gergnz (gergnz) wrote :

This didn't work for me until I removed all mentions of request in /usr/lib/python2.7/dist-packages (egg file, etc).

Revision history for this message
Adam Porter (alphapapa) wrote :

$ sudo apt-get install python-pip
$ pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 351, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2363, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2088, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 11, 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

PIP is broken out-of-the-box on Trusty. :/

Revision history for this message
Andrew Plummer (plummer574) wrote :

I poked around a bit and found that requests was being loaded from /usr/local/lib/python2.7/dist-packages as it appeared before /usr/lib/python2.7/dist-packages in my python path.

The /usr/local/lib/ version was 1.1.0 but the /usr/lib/ was version 2.2.1.

Fixed it with:
sudo rm -rf /usr/local/lib/python2.7/dist-packages/requests

Not sure what it was that will have installed requests to here, but it would appear to not be a bug with requests, but rather two versions installed, and the old one is being preferred. Ripping out the old version fixed it.

Revision history for this message
stefan dye (stefandye) wrote :

Removing the old requests and using easy_install worked for me as well.

Revision history for this message
Lars (larsmans) wrote :

Same here: pip was loading requests, and also urllib3 from /usr/local/lib. When I removed both libraries by hand, it started working again. FYI, the bug appeared on my box only after a system upgrade to Linux Mint 17/Ubuntu 14.04; requests and urllib3 had been pip install'd before the upgrade. PYTHONPATH was not set.

Revision history for this message
Jonathan Reed (jdreed) wrote :

I am also encountering this in 14.04. I do not have a local copy of the 'requests' package (or in fact any packages other than python-usb). python-pip simply appears to be broken out of the box on 14.04.

Revision history for this message
Muelli (ubuntu-bugs-auftrags-killer) wrote :

FWIW: I encountered the same issue. Hoewever, I was able to make pip work again by removing everything named "requests" in ~/.local/lib/, i.e. find ~/.local/lib -name '*requests*' -delete

Revision history for this message
Muelli (ubuntu-bugs-auftrags-killer) wrote :

In particular, requests-2.4 seems to upset pip. requests <= 2.2 seems to work better.

Revision history for this message
gazpachoking (chase-sterling) wrote :

Looks like pip is vendoring requests, however in the ubuntu package the imports is pip/download.py are not properly pointing to the vendored version of requests.

Revision history for this message
blau (blau-christoph) wrote :

I encountered the same problem

# pip list
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 351, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2363, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2088, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 11, 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

...and resolved it

# easy_install -U pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Best match: pip 1.5.6
Downloading https://pypi.python.org/packages/source/p/pip/pip-1.5.6.tar.gz#md5=01026f87978932060cc86c1dc527903e
Processing pip-1.5.6.tar.gz
Writing /tmp/easy_install-u_hfjN/pip-1.5.6/setup.cfg
Running pip-1.5.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-u_hfjN/pip-1.5.6/egg-dist-tmp-oG6xQ8
warning: no files found matching 'pip/cacert.pem'
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.rst' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Adding pip 1.5.6 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

Revision history for this message
MxxCon (mxxcon) wrote :

What can be done to resolve this problem using Ubuntu's own packages?

Revision history for this message
Erik Kristensen (unhandledexception) wrote :

This appears to be broken still? This is a pretty big issue IMO and it has been months. Any idea on when it will be fixed?

Revision history for this message
Simon Biggs (simon-grant-biggs) wrote :

Also a problem with python3-pip.

sudo apt-get remove python3-pip
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python3 get-pip.py

fixed it for me.

Revision history for this message
Nico Schlömer (nschloe) wrote :

This is probably a python-requests bug; see <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766419#23>. (It's fixed in Debian.)

Revision history for this message
William Grant (wgrant) wrote :

All Ubuntu releases have compatible versions of pip and requests (utopic still has requests 2.3.0, and vivid has the fixed 2.4.3-2 from Debian). If you're seeing this bug, you probably have a new or old copy of requests in /usr/local/lib/python2.7/dist-packages or similar.

Changed in python-pip (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Oguz Yarimtepe (oguzy) wrote :

I am still having the same problem in 14.04

Revision history for this message
Steff (laurent-steff-r) wrote :

Hi,

Installing CloudMonkey with a working pip on Ubuntu 14.04 installed with python-pip breaks it with the same message.

How to reproduce

- fresh and working python-pip installed
- pip install cloudmonkey
- pip instal --upgrade cloudmonkey

Effectively pip install by itself a request module

This is what is installed :

---
$ ls /usr/local/lib/python2.7/dist-packages/
argcomplete prettytable.pyc
argcomplete-0.8.3.egg-info pygments
cloudmonkey Pygments-2.0.1.dist-info
cloudmonkey-5.3.0.egg-info requests
prettytable-0.7.2.egg-info requests-2.4.3.dist-info
prettytable.py
---

Hope this helps.

Revision history for this message
Kevin Cole (kjcole) wrote :

William Grant (wgrant) answer solved my problem... (I'm guessing the Ubuntu SDK dependencies from the PPA put stuff there, and now a supported python-requests puts it in /usr/lib/, but maybe doesn't clean out the /usr/local/lib/ versions?)

Revision history for this message
jamesjara (jamesjara) wrote :

maybe this temporary fix can help you "sudo easy_install requests" I have created a post, http://jamesjara.com/fix-ubuntu-requests-compat-import-incompleteread

Revision history for this message
Martin Thoma (themoosemind) wrote :

I just executed

```bash
$ sudo pip install natsort matplotlib coveralls --upgrade
[... it worked ...]
$ sudo pip install matplotlib --upgrade
[sudo] password for moose:
Traceback (most recent call last):
  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
```

Revision history for this message
Jens KLEIN (jensens) wrote :

this one hits me too. please fix it.

Revision history for this message
Plecton (northend) wrote :

I seem to have fixed this by going into the "/usr/local/lib/python2.7/dist-packages/" folder and renaming the folders "requests" to "requests.old" and "requests-2.4.1.dist-info" to "requests-2.4.1.dist-info.old". The pip now works properly again.

Revision history for this message
Ipeacocks (ipeacocks) wrote :

easy_install fixes pip ;)

$ sudo easy_install -U pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Best match: pip 6.0.2
Downloading https://pypi.python.org/packages/source/p/pip/pip-6.0.2.tar.gz#md5=dd396e135b8abdd0097401cb8b66ea30
Processing pip-6.0.2.tar.gz
Writing /tmp/easy_install-IgtBKt/pip-6.0.2/setup.cfg
Running pip-6.0.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-IgtBKt/pip-6.0.2/egg-dist-tmp-FjYpKA
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching 'pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching 'dev-requirements.txt'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
Adding pip 6.0.2 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/pip-6.0.2-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

Revision history for this message
Ohadcn (ohadcn) wrote :

i experienced similar symptoms.
it finally turns out that the problem was the permissions of /usr/local/lib/python2.7/dist-packages (and it's subfolders)
I'm still trying to figure out what it was that touched the permissions (or why it has that permission from the begining), but running 'chmod 755 /usr/local/lib/python2.7/dist-packages/* -R' fixed the problem.
hope it will help you too.

Revision history for this message
windowsguy (something-f) wrote :

With Python 3.4 and pip3, this is what worked for me:
cd /usr/local/lib/python3.4/dist-packages
sudo mv requests-2.4.2.dist-info.old requests-2.4.2.dist-info

Revision history for this message
windowsguy (something-f) wrote :

Ugh, no way to edit comments... Above, I moved requests to requests.old.
I also have requests-2.4.2.dist-info is not causing this problem, so I moved that back (which is the last line above).

Changed in python-pip (Debian):
status: New → Fix Committed
Changed in python-pip (Debian):
status: Fix Committed → Fix Released
Revision history for this message
piccobello (piccobello) wrote :

Same issue in (K)ubuntu 14.04.2 LTS (using python 2.7)
In my case an old requests version 1.2.3 was sitting in my user folder,
so the following solved the issue for me:

rm -rf ~/.local/lib/python2.7/site-packages/requests-1.2.3.egg-info ~/.local/lib/python2.7/site-packages/requests

Thanks Muelli, however I do *not* recomment the find approach: im my case it matched files from other packages as well

Revision history for this message
rbleeker (rbleeker) wrote :

I am aware that this might not be the right place to ask, but here it goes anyway:

Can anyone explain to me why python-pip installs requirements for livestreamer in /usr/local/ ? This is against FHS and Debian policies about what /usr/local/ may be used for. I used to work in an environment where /usr/local/ was an NFS mount to which clients had no write access, so any attempt by the package manager, maintenance scripts or for example puppet to place files in /usr/local/ would fail. This would have made maintaining packages like livestreamer very cumbersome. I hope this will get addressed in the future?

Revision history for this message
Anders Hall (a.hall) wrote :

Comment 34 worked for pip https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1306991/comments/34

Comment 37 did not work for pip3 since I have no older folder that works https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1306991/comments/37

Any way to recreate those request folder with apt for pip3?

Revision history for this message
Pablo (pabloa98) wrote :

#33 fix the issue too.

Revision history for this message
Anthony Green (anthony-green) wrote :

Getting this same issue with Ubuntu 15.04 (Minimal install+XFCE)

pip --version
Traceback (most recent call last):
  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/__init__.py", line 521, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2632, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2312, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2318, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, 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

Changed in python-pip (Ubuntu):
status: Invalid → Confirmed
Revision history for this message
Jonathan (desertshadow) wrote :

This affects me too in Ubuntu 15.04, fixed it with:
sudo easy_install -U pip

Revision history for this message
Alexander Buchner (alexander-buchner) wrote :

Will there be released a fix?

Revision history for this message
Michael Kovarik (fractalsandflowers) wrote :

The bug is with pip 1.5.4 itself. I recommend upgrading pip.

Revision history for this message
Sylvain Garcia (garcia-6l20) wrote :

Solved by uninstalling : sudo apt-get remove pyton3-pip
Then reinstall with easy_install: sudo easy_install3 pip

Revision history for this message
David Röthlisberger (drothlis) wrote :

On my Ubuntu 15.04 system, the system-supplied pip (`apt install python-pip`, v1.5.6) works correctly with the system-supplied requests (python-requests -- v2.4.3 -- it's a dependency of python-pip).

Then after installing a package with pip (in my case `pip install --user jira`) it installed a newer version of requests (v2.7.0) into ~/.local/lib/python2.7, presumably because the package I installed specified that it needed a newer version of requests. This causes pip to break with:

    from requests.compat import IncompleteRead
    ImportError: cannot import name IncompleteRead

My solution was to delete the offending requests library, then upgrade pip with `sudo pip install --upgrade pip`, and then reinstalling the pip packages I wanted.

Revision history for this message
Kris Warner (kdwarn) wrote :

I fixed this by doing same thing as #33, then removing and and re-installing pip. The call to autoremove was key - it didn't work when I tried without this.

sudo apt-get purge python-pip

sudo agt-get autoremove

and re-installing

sudo apt-get install python-pip

Revision history for this message
M.Rouget (matthieu-rouget) wrote :

Tried to do the same as #48 to fix pip errors on my Ubuntu 15.10 (upgraded from 14.04/15.04).

This does not work :

$ sudo apt-get purge -y python-pip
$ sudo apt-get -y autoremove
$ sudo apt-get install -y python-pip
$ pip --version

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
[...]
    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

However, this works:

$ sudo apt-get purge -y python-pip
$ sudo easy_install pip

Now I have a fully function pip

Revision history for this message
Tankypon (tankypon) wrote :

I do the same as the previous post said:
$ sudo apt-get purge -y python-pip
$ sudo easy_install pip

And I have too a fully functional pip now!

Revision history for this message
Mohamed Ragab (moragab) wrote :

The following worked for me

$ sudo rm -rf /usr/local/lib/python2.7/dist-packages/requests*

Now I have a fully functional pip

Revision history for this message
moueza (mouezapeter) wrote :

Same bug in Ubuntu 15.10

Revision history for this message
Kevin Dalley (nereocystis) wrote :

I had just local pip, and used this command to clean it up:

rm -rf .local/lib/python2.7/site-packages/requests

Revision history for this message
stevenschlansker (stevenschlansker) wrote :

We rolled out a new pip package to all our systems this morning. Since it happened to pull in a new requests library, we now are the proud owners of approximately 50 hosts with completely broken pip installs. Exact same problem described here.

How does a bug this serious persist in a LTS release for two years, without even being triaged or assigned a priority?!?!

Revision history for this message
moueza (mouezapeter) wrote :

Still failure in Ubuntu 15.10 when "sudo pip install python-openstackclient" from https://console.ng.bluemix.net/docs/virtualmachines/vm_index.html#vm_setup_cli

Revision history for this message
moueza (mouezapeter) wrote :

For Ubuntu : sudo apt-get install python-openstackclient

Revision history for this message
moueza (mouezapeter) wrote :

sudo pip install IncompleteRead

Revision history for this message
Martin Thoma (themoosemind) wrote :
Revision history for this message
Anentropic (anentropic) wrote :

#57 sudo pip install IncompleteRead

...that's not going to work

Revision history for this message
Kai Kasurinen (kai-kasurinen) wrote :
Changed in python-pip (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.