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

PythonPipImporterrorArchlinux

Python Problem Overview


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: https://stackoverflow.com/questions/50202238/requestsdependencywarning-urllib3-1-9-1-or-chardet-2-3-0-doesnt-match-a-su <-- This did not fix my problem.

Python Solutions


Solution 1 - Python

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.

Solution 2 - Python

Simply you have to upgrade you requests

  pip3 install requests

Solution 3 - Python

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.

Solution 4 - Python

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

Solution 5 - Python

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

Solution 6 - Python

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJOhnView Question on Stackoverflow
Solution 1 - PythonPaulView Answer on Stackoverflow
Solution 2 - PythonMohammad AarifView Answer on Stackoverflow
Solution 3 - Pythonİbrahim Ş. ÖrencikView Answer on Stackoverflow
Solution 4 - PythonАлександр БалуевView Answer on Stackoverflow
Solution 5 - PythonehhView Answer on Stackoverflow
Solution 6 - PythonRituraj BorpujariView Answer on Stackoverflow