2016/01/12 update
--Added about'requests [security]'. --Added about Software Collections.
After installing a new Python or updating a package, do you ever think that the following warning appears when you run Python? (I was surprised to get a warning like this when I updated SoftLayer's Python package and tried to execute a command for the first time in a while). In this article, I'll show you how to avoid this Insecure Platform Warning warning.
# python test1.py
/usr/lib/python2.6/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
(Omitted below)
# sl vs list
/usr/lib/python2.6/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
(Omitted below)
As you can see from the link below, it is implemented so that this warning message will appear in requests-2.6.0 or later. So a simple solution is to pip back requests to 2.5.3 by version. http://fossies.org/diffs/requests/2.5.3_vs_2.6.0/requests/packages/urllib3/util/ssl_.py-diff.html
# pip list | grep requests
requests (2.6.2)
# pip install requests==2.5.3
# pip list | grep requests
requests (2.5.3)
By the way, if you try to introduce a new package or upgrade, the requests that have been deferred may be updated at the same time (I hope you can downgrade later) If you defer it in requests 2.5.3. If you want to complete a new installation or package update in one shot, you can do as follows.
Example of introducing a new SoftLayer package
# pip install SoftLayer requests==2.5.3
Example of updating SoftLayer packages
# pip install --upgrade SoftLayer requests==2.5.3
http://stackoverflow.com/questions/29099404/ssl-insecureplatform-error-when-using-requests-package
requests[security]Introduction of
# yum install -y openssl-devel python-devel libffi-devel
# pip install 'requests[security]'
If you change the Python version to 2.7.9 or later, this warning will disappear. However, depending on the OS, Python is used at the system level, for example, CentOS and yum of RHEL are implemented in Python. Therefore, I personally think that changing the Python version at the system level is not very desirable.
In order to coexist with the new Software Package, CentOS and RHEL systems provide a component called Software Collections. You can use this to introduce Python 2.7 or Python 3.3. http://qiita.com/murachi1208/items/202bff84964188619f57 http://www.idcf.jp/blog/cloud/software-collections-for-centos-6/
In reality, I think it is better to use pyenv or virtualenv, which can switch versions as appropriate at the user level. Personally, it is very useful. Installing and compiling Python individually is quite a hassle, and I sometimes want to try different versions. How to use ... It seems that there are as many materials as you can if you google including Qiita, so I will omit it this time. https://github.com/yyuu/pyenv-virtualenv http://qiita.com/yuta_h3/items/2988c4d0811bf8c344c0 http://qiita.com/search?page=2&q=pyenv&sort=rel&utf8=%E2%9C%93
https://urllib3.readthedocs.org/en/latest/security.html?highlight=insecureplatformwarning http://stackoverflow.com/questions/29134512/insecureplatformwarning-a-true-sslcontext-object-is-not-available-this-prevent