174

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.

3

7 Answers 7

278

The proper command for fixing this is:

pip3 install --upgrade requests

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

0
63

Simply you have to install latest version of requests

  pip3 install requests
3
  • 9
    "you have to upgrade you requests". But this command does not upgrade the request module.
    – wovano
    Oct 23, 2022 at 9:08
  • 1
    ^ nor does upgrading even do anything, jfc Mar 8 at 19:17
  • 1
    This does not work if the module was already installed.
    – wovano
    Apr 5 at 7:25
22

I fixed this problem with

pip install --upgrade requests==2.20.1

If you see version incompatible message like following, you should try other versions. All versions are: here

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.
3
  • 4
    No need to specify versions unless you need to.
    – Qumber
    Nov 23, 2020 at 7:27
  • 1
    Use either --upgrade either ==2.20.1; it does not make sense to use both at the same time.
    – bfontaine
    Feb 13 at 9:54
  • this worked for me , the more advanced version 2-27.1 was apparently incompatible
    – rightsized
    Aug 8 at 18:46
5

I got this problem when I tried to run docker-compose: urllib3 (1.24.1) or chardet (3.0.4) doesn't match a supported version

In my case I solved by remove the docker-compose:

sudo apt-get remove docker-compose

and installing:

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

Edit: Now it should contain v on specifying its version.

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

Then run:

sudo chmod +x /usr/local/bin/docker-compose

4

Find this and look in requests/init.py source file:

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
2

In my case upgrading requests didn't work. pip3 install requests

I used ehh's solution of downloading docker-compose again

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

Then adding execution capability to the file by sudo chmod +x /usr/bin/docker-compose

0

I got the same problem and fixed this problem with the command

pip install --upgrade requests==2.20.1

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.