164

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.

JOhn
  • 1,763
  • 2
  • 6
  • 7
  • 4
    Possible duplicate of [RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) doesn't match a supported version](https://stackoverflow.com/questions/50202238/requestsdependencywarning-urllib3-1-9-1-or-chardet-2-3-0-doesnt-match-a-su) – phd May 15 '19 at 18:45
  • https://stackoverflow.com/search?q=%5Bpython%5D+RequestsDependencyWarning%3A+urllib3+or+chardet+doesn%27t+match+a+supported+version – phd May 15 '19 at 18:45
  • "(link to seeming duplicate) This did not fix my problem." -- can you provide more details as to why it's not a dupe? Did you try all 21 answers from that thread? If so, please describe how they didn't work specifically (what error/result/behavior did you experience). Absent any follow-up, I vote to close this as a dupe. Thanks. – ggorlen Apr 20 '22 at 03:57

7 Answers7

265

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.

Paul
  • 20,883
  • 7
  • 57
  • 74
65

Simply you have to install latest version of requests

  pip3 install requests
Mohammad Aarif
  • 1,619
  • 13
  • 19
21

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.
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

ehh
  • 1,659
  • 2
  • 13
  • 11
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
bfontaine
  • 18,169
  • 13
  • 73
  • 107
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

Ardent Coder
  • 3,777
  • 9
  • 27
  • 53
0

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

pip install --upgrade requests==2.20.1

  • It's a copy of [this answer](https://stackoverflow.com/a/58250787/2745495) from 2019. – Gino Mempin May 20 '23 at 03:32
  • Please don't repeat existing answers. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation), you will be able to [vote up questions and answers](https://stackoverflow.com/help/privileges/vote-up) that you found helpful. - [From Review](/review/late-answers/34400111) – Gino Mempin May 20 '23 at 03:33