I tried running setup.py on Amazon Linux 4.4.19-29.55.amzn1.x86_64, but received the following warning:
AWS region could not be automatically detected. Cause:Cannot access metadata service. Cause: Timeout value connect was (0.3, 0.5), but it must be an int or float.
This seems to happen because my system python is 2.7.12, which was installed as a dependency of aws-cli, but the package that resolves for python-pip is actually python27-pip:
$ sudo yum install -y python-pip
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest | 2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
Package python26-pip-6.1.1-1.23.amzn1.noarch already installed and latest version
Nothing to do
This means that setup.py is run by python27, which uses python26-pip to install requests, leaving the latest version of requests unavailable. My python27 interpreter is using requests-1.2.3 from /usr/lib/python2.7/dist-packages/, which is why the warning I received was about the timeout parameter instead of a failed import.
Maybe a better way would be to just use pip from setup.py:
import pip
pip.main(['install', '-U', 'requests>=2.4.0'])