aws-cliのアップデート

sudo pip install -U awscliでアップデートできるが…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
$ aws --version
aws-cli/1.16.273 Python/2.7.15+ Linux/4.15.0-1058-aws botocore/1.13.17

$ sudo pip install -U awscli
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not ownd by the current user and the cache has been disabled. Please check the permissons and owner of that directory. If executing pip with sudo, you may want sudo' -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned bythe current user and caching wheels has been disabled. check the permissions an owner of that directory. If executing pip with sudo, you may want sudo's -H flg.
Collecting awscli
Downloading https://files.pythonhosted.org/packages/fb/3b/7b5db1f1b153971fc5cbb2102547a1dd1cf21556eacd80cc6c029939b9a/awscli-1.18.2-py2.py3-none-any.whl (2.MB)
100% |????????????????????????????????| 2.9MB 395kB/s
Collecting PyYAML<5.3,>=3.10 (from awscli)
Downloading https://files.pythonhosted.org/packages/8d/c9/e5be955a117a1ac548cd31e37e8fd7b02ce987f9655f5c7563c656d5dcb/PyYAML-5.2.tar.gz (265kB)
100% |????????????????????????????????| 266kB 3.1MB/s
Collecting botocore==1.15.2 (from awscli)
Downloading https://files.pythonhosted.org/packages/0b/44/906ebd1df90c435bdee5cbca6bae7a14d94c5b33c7517fddf540dbc6823/botocore-1.15.2-py2.py3-none-any.whl (.9MB)
100% |????????????????????????????????| 5.9MB 207kB/s
Requirement already up-to-date: rsa<=3.5.0,>=3.1.2 in ./.local/lib/python2.7/sie-packages (from awscli)
Collecting s3transfer<0.4.0,>=0.3.0 (from awscli)
Downloading https://files.pythonhosted.org/packages/69/79/e6afb3d8b0b4e96cefbc690f741d7dd24547ff1f94240c997a26fa908d3/s3transfer-0.3.3-py2.py3-none-any.whl 69kB)
100% |????????????????????????????????| 71kB 10.7MB/s
Requirement already up-to-date: docutils<0.16,>=0.10 in ./.local/lib/python2.7/ite-packages (from awscli)
Collecting colorama<0.4.4,>=0.2.5; python_version != "3.4" (from awscli)
Downloading https://files.pythonhosted.org/packages/c9/dc/45cdef1b4d119eb9631b3117e6d5708a08029992b2fee2c143c7a0a5cc5/colorama-0.4.3-py2.py3-none-any.whl
Requirement already up-to-date: jmespath<1.0.0,>=0.7.1 in ./.local/lib/python2./site-packages (from botocore==1.15.2->awscli)
Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.15.2->awscli)
Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef8758624207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-anywhl (227kB)
100% |????????????????????????????????| 235kB 5.3MB/s
Collecting urllib3<1.26,>=1.20; python_version != "3.4" (from botocore==1.15.2-awscli)
Downloading https://files.pythonhosted.org/packages/e8/74/6e4f91745020f967d0932bb2b8b9b10090957334692eb88ea4afe91b77f/urllib3-1.25.8-py2.py3-none-any.whl (15kB)
100% |????????????????????????????????| 133kB 8.6MB/s
Collecting pyasn1>=0.1.3 (from rsa<=3.5.0,>=3.1.2->awscli)
Downloading https://files.pythonhosted.org/packages/62/1e/a94a8d635fa3ce4cfc7506003548d0a2447ae76fd5ca53932970fe3053f/pyasn1-0.4.8-py2.py3-none-any.whl (77k)
100% |????????????????????????????????| 81kB 10.9MB/s
Requirement already up-to-date: futures<4.0.0,>=2.2.0; python_version == "2.7" n ./.local/lib/python2.7/site-packages (from s3transfer<0.4.0,>=0.3.0->awscli)
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore==1.15.2->awscli
Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a27669c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Installing collected packages: PyYAML, six, python-dateutil, urllib3, botocore,s3transfer, colorama, awscli, pyasn1
Found existing installation: PyYAML 5.1.2
Uninstalling PyYAML-5.1.2:
Successfully uninstalled PyYAML-5.1.2
Running setup.py install for PyYAML ... done
Found existing installation: six 1.13.0
Uninstalling six-1.13.0:
Successfully uninstalled six-1.13.0
Found existing installation: python-dateutil 2.8.0
Uninstalling python-dateutil-2.8.0:
Successfully uninstalled python-dateutil-2.8.0
Found existing installation: urllib3 1.25.7
Uninstalling urllib3-1.25.7:
Successfully uninstalled urllib3-1.25.7
Found existing installation: botocore 1.13.17
Uninstalling botocore-1.13.17:
Successfully uninstalled botocore-1.13.17
Found existing installation: s3transfer 0.2.1
Uninstalling s3transfer-0.2.1:
Successfully uninstalled s3transfer-0.2.1
Found existing installation: colorama 0.4.1
Uninstalling colorama-0.4.1:
Successfully uninstalled colorama-0.4.1
Found existing installation: awscli 1.16.273
Uninstalling awscli-1.16.273:
Successfully uninstalled awscli-1.16.273
Found existing installation: pyasn1 0.4.7
Uninstalling pyasn1-0.4.7:
Successfully uninstalled pyasn1-0.4.7
Successfully installed PyYAML-5.2 awscli-1.18.2 botocore-1.15.2 colorama-0.4.3 yasn1-0.4.8 python-dateutil-2.8.1 s3transfer-0.3.3 six-1.14.0 urllib3-1.25.8

$ /usr/local/bin/aws --version
aws-cli/1.18.2 Python/2.7.15+ Linux/4.15.0-1058-aws botocore/1.15.2

謎のエラー発生

アップデート後にaws-cliを実行するとImportError: No module named rsaが発生。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Traceback (most recent call last):
File "/usr/local/bin/aws", line 27, in <module>
sys.exit(main())
File "/usr/local/bin/aws", line 23, in main
return awscli.clidriver.main()
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 68, in main
driver = create_clidriver()
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 78, in create_clidriver
event_hooks=session.get_component('event_emitter'))
File "/usr/local/lib/python2.7/dist-packages/awscli/plugin.py", line 44, in load_plugins
modules = _import_plugins(plugin_mapping)
File "/usr/local/lib/python2.7/dist-packages/awscli/plugin.py", line 61, in _import_plugins
module = __import__(path, fromlist=[module])
File "/usr/local/lib/python2.7/dist-packages/awscli/handlers.py", line 28, in <module>
from awscli.customizations.cloudfront import register as register_cloudfront
File "/usr/local/lib/python2.7/dist-packages/awscli/customizations/cloudfront.py", line 17, in <module>
import rsa
ImportError: No module named rsa

対応策

Exceptions with the latest release #641を参考に、sudo pip install awscli --force-reinstall --upgradeで再インストールによって復旧