Python version, urllib3 and chardet dependency warnings

I know this is a warning only, but isn’t there a way to resolve it (instead of suppressing it):

$ ansible openscaptesting -m ping
/usr/lib/python3.6/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.7) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)
openscaptesting | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}

My ansible version is:

$ ansible --version
ansible 2.9.27
  config file = /home/admin/ansiblework/ansible.cfg
  configured module search path = ['/home/admin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Nov 17 2021, 16:10:06) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]

and my python packages are:

$ rpm -qa | egrep 'python36|chardet|urllib3'
python36-3.6.8-38.module_el8.5.0+2569+5c5719bc.x86_64
python3-urllib3-1.24.2-5.el8.noarch
python3-chardet-3.0.4-7.el8.noarch

Checking /usr/lib/python3.6/site-packages/requests/__init__.py:

    # 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
    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
    assert major == 3
    assert minor < 1
    assert patch >= 2

It seems that urllib3 is the issue here, but I can’t downgrade the version:

$ sudo dnf downgrade python3-urllib3
[sudo] password for admin: 
Last metadata expiration check: 0:47:01 ago on Thu 02 Dec 2021 09:26:12 AM AEDT.
Package python3-urllib3 of lowest version already installed, cannot downgrade it.
Dependencies resolved.
Nothing to do.
Complete!

ansible complains about urllib3 1.26.7 but the urllib that is installed via rpm is 1.24.2. maybe you have urllib 1.26.7 installed via pip?

Good point! How did I miss that!

As far as I can recall, I didn’t do anything via pip. Let me try the steps again and confirm. Thanks for looking at this.