How do I fix 'ImportError: cannot import name IncompleteRead'?
While this previous answer might be the reason, this snipped worked for me as a solution (in Ubuntu 14.04
):
First remove the package from the package manager:
# apt-get remove python-pip
And then install the latest version by side:
# easy_install pip
(thanks to @Aufziehvogel, @JunchaoGu)
This problem is caused by a mismatch between your pip installation and your requests installation.
As of requests version 2.4.0 requests.compat.IncompleteRead
has been removed. Older versions of pip, e.g. from July 2014, still relied on IncompleteRead
. In the current version of pip, the import of IncompleteRead
has been removed.
So the one to blame is either:
- requests, for removing public API too quickly
- Ubuntu for updating pip too slowly
You can solve this issue, by either updating pip via Ubuntu (if there is a newer version) or by installing pip aside from Ubuntu.
For fixing pip3 (worked on Ubuntu 14.10):
easy_install3 -U pip
Or you can remove all requests
.
For example:
rm -rf /usr/local/lib/python2.7/dist-packages/requests*
On Ubuntu 14.04 I resolved this by using the pip installation bootstrap script, as described in the documentation
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
That's an OK solution for a development environment.