AWS CLIをアップグレード(El Capitan)

More than 3 years have passed since last update.


はじめに

なんとなく、アップグレードしたいなと思って、AWS CLIをアップグレード。

すんなりいかなかったので、ログ残しします。


つまづき

実行したコマンドはこちら

sudo pip install -U awscli

はい。案の定、エラーが出ました。

The directory '/Users/userareaz/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

You are using pip version 7.1.0, however version 8.0.2 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

The directory '/Users/userareaz/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Collecting awscli

Downloading awscli-1.10.1-py2.py3-none-any.whl (880kB)

100% |████████████████████████████████| 884kB 494kB/s

Collecting botocore==1.3.23 (from awscli)

Downloading botocore-1.3.23-py2.py3-none-any.whl (2.2MB)

100% |████████████████████████████████| 2.2MB 120kB/s

Collecting rsa<=3.3.0,>=3.1.2 (from awscli)

Downloading rsa-3.3-py2.py3-none-any.whl (44kB)

100% |████████████████████████████████| 45kB 5.8MB/s

Requirement already up-to-date: colorama<=0.3.3,>=0.2.5 in /Library/Python/2.7/site-packages (from awscli)

Requirement already up-to-date: docutils>=0.10 in /Library/Python/2.7/site-packages (from awscli)

Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.3.23->awscli)

Downloading jmespath-0.9.0-py2.py3-none-any.whl

Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.3.23->awscli)

Downloading python_dateutil-2.4.2-py2.py3-none-any.whl (188kB)

100% |████████████████████████████████| 192kB 2.2MB/s

Collecting pyasn1>=0.1.3 (from rsa<=3.3.0,>=3.1.2->awscli)

Downloading pyasn1-0.1.9-py2.py3-none-any.whl

Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore==1.3.23->awscli)

Downloading six-1.10.0-py2.py3-none-any.whl

Installing collected packages: jmespath, six, python-dateutil, botocore, pyasn1, rsa, awscli

Found existing installation: jmespath 0.7.1

Uninstalling jmespath-0.7.1:

Successfully uninstalled jmespath-0.7.1

Found existing installation: six 1.4.1

DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.

Uninstalling six-1.4.1:

Exception:

Traceback (most recent call last):

File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/basecommand.py", line 223, in main

status = self.run(options, args)

File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py", line 299, in run

root=options.root_path,

File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 640, in install

requirement.uninstall(auto_confirm=True)

File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py", line 726, in uninstall

paths_to_remove.remove(auto_confirm)

File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_uninstall.py", line 125, in remove

renames(path, new_path)

File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/__init__.py", line 314, in renames

shutil.move(old, new)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move

copy2(src, real_dst)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2

copystat(src, dst)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat

os.chflags(dst, st.st_flags)

OSError: [Errno 1] Operation not permitted: '/tmp/pip-Deg5y5-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

「six」というものがなんか悪さしてそうな感じのエラーが出ています。


「six」との出会い

実は、「six」に関するエラーとの付き合いは、これが2回目。

どうも、「El Capitan」と「six」の相性というかなんかわかりませんが、

色々とエラーが出るようです。

前回は「AWS SDK for Python (Boto3)」をインストールした時。

その時にもありましたが、オプションをつけて、「six

」と関わらないようにしたらいいようです。

ということで、 --ignore-installed sixこれをつけて実行します。


Re:Install

さて、コマンドをうちます。

sudo pip install awscli --upgrade --ignore-installed six

これで、見事成功!