When I try to install anything with pip or pip3, I get:
$ sudo pip3 install python3-tk
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip3')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2476, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2190, in load
['__name__'])
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 61, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python3/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python3/dist-packages/pip/download.py", line 25, in <module>
from requests.compat import IncompleteRead
ImportError: cannot import name 'IncompleteRead'
I have a Ubuntu 14.10 system.
How can I fix this problem?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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)
Method 2
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.
Method 3
For fixing pip3 (worked on Ubuntu 14.10):
easy_install3 -U pip
Method 4
Or you can remove all requests.
For example:
rm -rf /usr/local/lib/python2.7/dist-packages/requests*
Method 5
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.
Method 6
The problem is the Python module requests. It can be fixed by
$ sudo apt-get purge python-requests [now requests and pip gets deinstalled] $ sudo apt-get install python-requests python-pip
If you have this problem with Python 3, you have to write python3 instead of python.
Method 7
This should work for you. Follow these simple steps.
First, let’s remove the pip which is already installed so it won’t cause any error.
Open Terminal.
Type: sudo apt-get remove python-pip
It removes pip that is already installed.
Method-1
Step: 1 sudo easy_install -U pip
It will install pip latest version.
And will return its address: Installed /usr/local/lib/python2.7/dist-packages/pip-6.1.1-py2.7.egg
or
Method-2
Step: 1 go to this link.
Step: 2 Right click >> Save as.. with name get-pip.py .
Step: 3 use: cd to go to the same directory as your get-pip.py file
Step: 4 use: sudo python get-pip.py
It will install pip latest version.
or
Method-3
Step: 1 use: sudo apt-get install python-pip
It will install pip latest version.
Method 8
Simply running easy_install -U pip resolved my problem.
Method 9
Check wether you have an older version of requests sitting in your ~/.local/lib/python2.7/site-packages/ and remove it if it is the case (change path to reflect your python version). This solved the issue for me.
Method 10
My version of pip on ubuntu suggests:
pip install --upgrade pip
Method 11
In Windows, this worked from an administrative prompt:
- Delete
C:Python27Libsite-packagesrequests* easy_install requests==2.3pip install --upgrade pippip install --upgrade requests
Method 12
I tried with every answer avobe, but couldn’t make it.
Did this and worked
sudo apt-get purge python-virtualenv sudo pip install pip -U
After that I just installed virtualenv with pip
sudo pip install virtualenv
I built the virtualenv that I was working on and
the package was installed easily.
Get into the virtualenv by using source /bin/activate
and try to install your package, for example:
pip install terminado
It worked for me, although I was using python2.7 not python3
Method 13
Check if have a python interpreter alive in any of the terminal windows. If so kill it and try sudo pip which worked for me.
Method 14
- sudo apt-get remove python-pip
- sudo easy_install requests==2.3.0
- sudo apt-get install python-pip
Method 15
You can download recent packages manually from these pages:
- https://packages.debian.org/fr/stretch/all/python3-pip/download
- https://packages.debian.org/fr/stretch/all/python-pip-whl/download
Then, install it by running dpkg:
dpkg -i *.deb
Method 16
For CentOS I used this and it worked please use the following commands:
sudo pip uninstall requests sudo pip uninstall urllib3 sudo yum remove python-urllib3 sudo yum remove python-requests
(confirm that all those libraries have been removed)
sudo yum install python-urllib3 sudo yum install python-requests
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0