RequestsDependencyWarning: urllib3 (1.25.2) or chardet (3.0.4) doesn't match a supported version! Fix

Whenever I run my code with requests or do a pip install I get this message

/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.2) or chardet (3.0.4) doesn't match a supported version!
RequestsDependencyWarning)

I have tried upgrading chardet, urllib3 and requests but nothing is working, anyone know how can I fix this?

Edit: RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) doesn't match a supported version <-- This did not fix my problem.

119272 次浏览

Simply you have to upgrade you requests

  pip3 install requests

当我尝试运行码头作曲时,我遇到了这个问题: Urllib3(1.24.1)或 chardet (3.0.4)与支持的版本不匹配

在我的案例中,我通过删除码头组件解决了这个问题:

sudo apt-get remove docker-compose

及安装:

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

我解决了这个问题

pip install --upgrade requests==2.20.1

如果您看到如下版本不兼容的消息,您应该尝试其他版本。所有版本都是: 给你

ERROR: docker-compose 1.24.1 has requirement requests!=2.11.0,!=2.12.2,!=2.18.0,<2.21,>=2.6.1, but you'll have requests 2.21.0 which is incompatible.

在我的情况下,升级请求不起作用。 pip3 install requests

我用 呃的解决方案的下载码头-组成再次

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose

然后通过以下方法向文件添加执行能力 sudo chmod +x /usr/bin/docker-compose

解决这个问题的正确命令是:

pip3 install --upgrade requests

I upgraded from 2.21.0 to 2.24.0 and the error went away.

找到这个并查看 requests/init.py源文件:

def check_compatibility(urllib3_version, chardet_version):
urllib3_version = urllib3_version.split('.')
assert urllib3_version != ['dev']  # Verify urllib3 isn't installed from git.


# Sometimes, urllib3 only reports its version as 16.1.
if len(urllib3_version) == 2:
urllib3_version.append('0')


# Check urllib3 for compatibility.
major, minor, patch = urllib3_version  # noqa: F811
major, minor, patch = int(major), int(minor), int(patch)
# urllib3 >= 1.21.1, <= 1.24    !HERE!
assert major == 1
assert minor >= 21
assert minor <= 24


# Check chardet for compatibility.
major, minor, patch = chardet_version.split('.')[:3]
major, minor, patch = int(major), int(minor), int(patch)
# chardet >= 3.0.2, < 3.1.0    !HERE!
assert major == 3
assert minor < 1
assert patch >= 2