Preface Basically, the Python version upgrade of the system is NG. If you need a different version, specify PATH each time. However, I will leave the post in the hope that it will lead to the resolution when a similar error occurs. (Thank you for your comment, knoguchi!)
Since subprocess.check_call is used, when updating python of the server that uses boto3, it was often more than expected, so it is a memorandum. Here's what I did: ・ Python update (2.6-> 2.7) ・ Reinstall boto3 because it can no longer be imported due to ↑ ・ Pip installation required for ↑
It looks like the following
# python -V Python 2.6.6 # uname -a Linux hoge 2.6.32-573.12.1.el6.x86_64 #1 SMP Tue Dec 15 21:19:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Update from source code.
Install the required modules in advance.
# yum install zlib-devel openssl-devel
If you don't do this, later pip installations will fail.
# curl -kL https://bootstrap.pypa.io/get-pip.py | python % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1379k 100 1379k 0 0 11.7M 0 --:--:-- --:--:-- --:--:-- 24.0M Traceback (most recent call last): File "<stdin>", line 17759, in <module> File "<stdin>", line 162, in main File "<stdin>", line 82, in bootstrap zipimport.ZipImportError: can't decompress data; zlib not available
# curl -kL https://bootstrap.pypa.io/get-pip.py | python % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1379k 100 1379k 0 0 10.5M 0 --:--:-- --:--:-- --:--:-- 21.3M Traceback (most recent call last): File "<stdin>", line 17759, in <module> File "<stdin>", line 162, in main File "<stdin>", line 82, in bootstrap File "/tmp/tmpd34pU2/pip.zip/pip/__init__.py", line 15, in <module> File "/tmp/tmpd34pU2/pip.zip/pip/vcs/subversion.py", line 9, in <module> File "/tmp/tmpd34pU2/pip.zip/pip/index.py", line 30, in <module> File "/tmp/tmpd34pU2/pip.zip/pip/wheel.py", line 35, in <module> File "/tmp/tmpd34pU2/pip.zip/pip/_vendor/distlib/scripts.py", line 14, in <module> File "/tmp/tmpd34pU2/pip.zip/pip/_vendor/distlib/compat.py", line 31, in <module> ImportError: cannot import name HTTPSHandler
# cd /usr/local/src # curl -O https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz # tar zxf Python-2.7.11.tgz # cd Python-2.7.11 # ./configure # make && make altinstall # mv /usr/bin/python /usr/bin/python.26 # cp /usr/local/src/Python-2.7.11/python /usr/bin/python # python -V Python 2.7.11
Although I was able to update it above, I cleaned up everything.
It seems that yum is no longer available.
# yum list installed There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: No module named yum Please install a package which provides this module, or verify that the module is installed correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.7.11 (default, Jan 14 2016, 11:42:45) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] If you cannot solve this problem yourself, please go to the yum faq at: http://yum.baseurl.org/wiki/Faq
It corresponds by pointing the python used by yum to the old version.
vi /usr/bin/yum × ： #!/usr/bin/python ○ ： #!/usr/bin/python.26
It seems that importing boto3 will fail. (Because it is not included for 2.7) Supported by reinstallation.
# curl -kL https://bootstrap.pypa.io/get-pip.py | python # pip install boto3
It seems that the response is complete. Especially where yum can't be used, it's easy to overlook it if you don't know that yum is running on python.
You have to be careful about updates.