Q:

Python requests RequestsDependencyWarning which disappears after re-installing the same version of the library

I'm building a python environment within a docker container using a Dockerfile. One of the levels is to pip install a requirements.txt file which includes the following libraries:
chardet==3.0.4
requests==2.22.0
urllib3==1.25.6

After the image has been built I create a container instance and run the following inside it:
python -c "import requests"
which gives the following output:
/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.6) or chardet (2.2.1) doesn't match a supported version! RequestsDependencyWarning)

Fair enough, however if I reinstall requests, pip install --upgrade requests --force-reinstall, and run the same python command above I don't receive the warning.
I can check the versions of each library again within the container and they're exactly the same as before:
chardet==3.0.4
requests==2.22.0
urllib3==1.25.6

So why would requests have been issuing the error before, and how can I ensure this warning doesn't come up within my Docker image without having a dangling re-install level in my Dockerfile?
I haven't found any adverse affects so far while using requests within my code while the warning is popping-up, however I'd rather it not be there since something is obviously triggering it.
I've found a number of posts/articles that suggest just sticking with re-installing requests, however I wouldn't want this redundant step within the Dockerfile unless it was the only way to resolve the warning.
Interestingly reinstalling chardet also removes the warning however reinstalling urllib3 does not.
-- edit --
Dockerfile as requested:
FROM centos:7

# Install external yum repositories
RUN yum install -y \
        epel-release \
        https://repo.ius.io/ius-release-el7.rpm \
        && yum clean all

# Install required rpm dependencies
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py
RUN yum install -y \
        systemd-python.x86_64 \
        git222 \
        gcc \
        python2-devel \
        openldap-devel \
        python-perf \
        python-linux-procfs \
        python-schedutils \
        policycoreutils-python \
        python-slip \
        python-slip-dbus \
        && yum clean all

# Install required pip dependencies
ADD requirements.txt /home/admin/container_files/
RUN pip install setuptools==30.1.0
RUN pip install -r /home/admin/container_files/requirements.txt

# Final update of packages
RUN yum update -y && yum clean all

A:

the workaround will be to re-order the install in your file to:
chardet==3.0.4
urllib3==1.25.6
requests==2.22.0

now python -c "import requests" will work from the first time
and I suggest you to move :
RUN yum update -y && yum clean all

to second line , then that will be cached if you edit some of your later code.

