Anaconda-Python RequestsDependencyWarning: urllib3

2019-03-29 08:04发布

I am getting a warning that doesn't seem to be covered in any other online resource. I have Anaconda Python 3.6 installed. The warning I get when I create a new Conda environment is:

RequestsDependencyWarning: urllib3 (1.22) or chardet (2.3.0) doesn't match a supported version!
  RequestsDependencyWarning)

I thought it was a pip issue because of a possibly related question (not sure if it actually is: How to fix urllib3 RuntimeError: Requests dependency 'urllib3' must be version >= 1.21.1, < 1.22?). But I get the same issue:

 $ conda update pip
/Users/VincentLa/anaconda3/lib/python3.6/site-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.22) or chardet (2.3.0) doesn't match a supported version!
  RequestsDependencyWarning)

4条回答
别忘想泡老子
2楼-- · 2019-03-29 08:29

I had this same issue.

The cause is from your python instance being confused about multiple libraries with different versions in different locations.

This Ubuntu scenario that i had will also yield your error.

a) Ubuntu Python libraries installed via sudo apt-get install python3-requests will download source to /usr/lib/python*/dist-packages

b) Ubuntu Python libraries installed via sudo -H pip3 install requests will download source to /usr/local/lib/python*/dist-packages

c) OS PATH & PYTHON_PATH point to /usr/lib:/usr/local/lib

d) You get a runtime warning because of python's library selection precedence. It therefore warns you that your current library in /usr/local/lib is incompatible with the dependancy located in the parent os library location /usr/lib

For your specific scenario, it seems you are using MacOS which has - python installed out of the box, and a custom python installation via anaconda.

To prevent conflict i recommend you remove the os python path /usr/lib/python when starting anaconda's python instance.

This will make sure it only uses anaconda's python libraries only, and not from your os.

查看更多
Root(大扎)
3楼-- · 2019-03-29 08:39
pip install --upgrade chardet

may help.

查看更多
霸刀☆藐视天下
4楼-- · 2019-03-29 08:39

What worked for me:

pip uninstall requests
pip install requests
pip uninstall docopt # maybe would not be installed.
pip install docopt # install it nonetheless.
查看更多
干净又极端
5楼-- · 2019-03-29 08:45

The only combination that helped me was (taken from http://blog.51cto.com/binuu/1948043):

pip uninstall urllib3    
pip uninstall  chardet
pip install requests

All other ones were unable to update chardet, as "it was already updated" (it appears, that info was taken for that lib in another location).

查看更多
登录 后发表回答