I am using python 2.7.12. When i do import requests
, I see the error below.
Tried uninstalling & installing requests, upgrading pip as well, but no luck, still same issue.
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
/home/test/.local/lib/python2.7/site-packages/requests/__init__.py:80:
RequestsDependencyWarning: urllib3 (1.13.1) or chardet (2.3.0) doesn't match a supported version!
RequestsDependencyWarning)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/test/.local/lib/python2.7/site-packages/requests/__init__.py", line 90, in <module>
from urllib3.exceptions import DependencyWarning
ImportError: cannot import name DependencyWarning
How can I solve this?
I had the same error and was able to fix it by upgrading requests
with the following command:
sudo pip install --upgrade requests
There are two cases that occur this problem.
There is duplicated PATH of pip.
apt-get remove python-pip
easy_install pip
This problem is caused by a mismatch between your pip installation and your requests installation.
You can solve this issue by updating pip.
In my case, I changed the code like following
Open up file: /usr/lib/python2.7/site-packages/pip/__init__.py and find this line.
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
Remove text before urllib3 and change like this.
from urllib3.exceptions import DependencyWarning
I will also try to make PR request about this.
If sudo pip install --upgrade requests
didn't worked (as in my case) try to uninstall and install requests with no-cache option:
sudo pip --no-cache-dir uninstall requests
sudo pip --no-cache-dir install requests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With