[PYTHON] Stories and solutions for AWS CLI updates

"By the way, I haven't updated the AWS CLI." I thought like this and tried updating. Then I was inadvertently addicted to ...


First of all, execute the update normally ...

[ore@server ~]$ sudo pip install --upgrade awscli
Collecting awscli from https://pypi.python.org/packages/py2.py3/a/awscli/awscli-1.8.4-py2.py3-none-any.whl#md5=f7a52bd35ff7ed1b8eede7cb82049f39
  Downloading awscli-1.8.4-py2.py3-none-any.whl (769kB)
    100% |################################| 770kB 3.5MB/s
Requirement already up-to-date: colorama<=0.3.3,>=0.2.5 in /usr/lib/python2.6/site-packages (from awscli)
Requirement already up-to-date: docutils>=0.10 in /usr/lib/python2.6/site-packages (from awscli)
Collecting argparse>=1.1 from https://pypi.python.org/packages/2.7/a/argparse/argparse-1.4.0-py2.py3-none-any.whl#md5=c37216a954c8669054e2b2c54853dd49 (from awscli)
  Downloading argparse-1.4.0-py2.py3-none-any.whl
Requirement already up-to-date: rsa<=3.1.4,>=3.1.2 in /usr/lib/python2.6/site-packages (from awscli)
Collecting botocore==1.2.2 (from awscli)
  Downloading botocore-1.2.2-py2.py3-none-any.whl (1.8MB)
    100% |################################| 1.8MB 3.0MB/s
Requirement already up-to-date: pyasn1>=0.1.3 in /usr/lib/python2.6/site-packages (from rsa<=3.1.4,>=3.1.2->awscli)
Collecting ordereddict==1.1 (from botocore==1.2.2->awscli)
  Downloading ordereddict-1.1.tar.gz
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help
    error: invalid command 'egg_info'
    Complete output from command python setup.py egg_info:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

       or: -c --help [cmd1 cmd2 ...]

       or: -c --help-commands

       or: -c cmd --help



    error: invalid command 'egg_info'

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dBji6C/ordereddict

I decided to look up the solution on the net because "that is an error?" "I see, I should update setuptools", so I made an update with a margin. (* Reference 1)

[ore@server ~]$ sudo pip install --upgrade setuptools
Collecting setuptools from https://pypi.python.org/packages/3.4/s/setuptools/setuptools-18.3.1-py2.py3-none-any.whl#md5=a21a4d02d0bab2eac499cca72faeb076
  Downloading setuptools-18.3.1-py2.py3-none-any.whl (462kB)
    100% |################################| 462kB 1.5MB/s
Installing collected packages: setuptools
  Found existing installation: setuptools 0.6rc11
    Can't uninstall 'setuptools'. No files were found to uninstall.

Successfully installed setuptools-0.6rc11

After completing the setuptools update, try updating the aws cli again ...

[ore@server ~]$ sudo pip install --upgrade awscli
Collecting awscli from https://pypi.python.org/packages/py2.py3/a/awscli/awscli-1.8.4-py2.py3-none-any.whl#md5=f7a52bd35ff7ed1b8eede7cb82049f39
  Using cached awscli-1.8.4-py2.py3-none-any.whl
Requirement already up-to-date: colorama<=0.3.3,>=0.2.5 in /usr/lib/python2.6/site-packages (from awscli)
Requirement already up-to-date: docutils>=0.10 in /usr/lib/python2.6/site-packages (from awscli)
Collecting argparse>=1.1 from https://pypi.python.org/packages/2.7/a/argparse/argparse-1.4.0-py2.py3-none-any.whl#md5=c37216a954c8669054e2b2c54853dd49 (from awscli)
  Using cached argparse-1.4.0-py2.py3-none-any.whl
Requirement already up-to-date: rsa<=3.1.4,>=3.1.2 in /usr/lib/python2.6/site-packages (from awscli)
Collecting botocore==1.2.2 (from awscli)
  Using cached botocore-1.2.2-py2.py3-none-any.whl
Requirement already up-to-date: pyasn1>=0.1.3 in /usr/lib/python2.6/site-packages (from rsa<=3.1.4,>=3.1.2->awscli)
Collecting ordereddict==1.1 (from botocore==1.2.2->awscli)
  Using cached ordereddict-1.1.tar.gz
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help
    error: invalid command 'egg_info'
    Complete output from command python setup.py egg_info:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

       or: -c --help [cmd1 cmd2 ...]

       or: -c --help-commands

       or: -c cmd --help



    error: invalid command 'egg_info'

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-HzKUun/ordereddict

** "Oh, the same error? It was written that if you do this, it will be cured!" ** (Don't blame others) So I decided to investigate another method (* Reference 2).

[ore@server ~]$ curl -O http://python-distribute.org/distribute_setup.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[ore@server ~]$ sudo python distribute_setup.py
python: can't open file 'distribute_setup.py': [Errno 2] No such file or directory
[ore@server ~]$

I thought, "It's weird. Why is there no file?" And tried to access it directly with a browser ...

http://python-distribute.org/distribute_setup.py → http://ww43.python-distribute.org/distribute_setup.py

"Oh, I'm redirected ... well, ** the domain is for sale! That's why there are no files that can be downloaded !! **"

So I decided to investigate further while I was about to cry. Then there was! The solution is!

[ore@server ~]$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
--2015-09-16 11:58:39--  https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
Resolving bitbucket.org... 131.103.20.167, 131.103.20.168
Connecting to bitbucket.org|131.103.20.167|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11434 (11K) [text/plain]
Saving to: “ez_setup.py”

100%[==========================================================>] 11,434      --.-K/s   in 0s

2015-09-16 11:58:40 (333 MB/s) - “ez_setup.py” saved [11434/11434]

[ore@server ~]$ sudo python ez_setup.py
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-18.3.1.zip
Extracting in /tmp/tmprVQjOi
Now working in /tmp/tmprVQjOi/setuptools-18.3.1
Installing Setuptools
running install
running bdist_egg
running egg_info
(snip...)
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
creating dist
creating 'dist/setuptools-18.3.1-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing setuptools-18.3.1-py2.6.egg
Copying setuptools-18.3.1-py2.6.egg to /usr/lib/python2.6/site-packages
Adding setuptools 18.3.1 to easy-install.pth file
Installing easy_install script to /usr/bin
Installing easy_install-2.6 script to /usr/bin

Installed /usr/lib/python2.6/site-packages/setuptools-18.3.1-py2.6.egg
Processing dependencies for setuptools==18.3.1
Finished processing dependencies for setuptools==18.3.1

"Maybe this is cool?"

[ore@server ~]$ sudo pip install --upgrade awscli
Collecting awscli from https://pypi.python.org/packages/py2.py3/a/awscli/awscli-1.8.4-py2.py3-none-any.whl#md5=f7a52bd35ff7ed1b8eede7cb82049f39
  Using cached awscli-1.8.4-py2.py3-none-any.whl
Requirement already up-to-date: colorama<=0.3.3,>=0.2.5 in /usr/lib/python2.6/site-packages (from awscli)
Requirement already up-to-date: docutils>=0.10 in /usr/lib/python2.6/site-packages (from awscli)
Collecting argparse>=1.1 from https://pypi.python.org/packages/2.7/a/argparse/argparse-1.4.0-py2.py3-none-any.whl#md5=c37216a954c8669054e2b2c54853dd49 (from awscli)
  Using cached argparse-1.4.0-py2.py3-none-any.whl
Requirement already up-to-date: rsa<=3.1.4,>=3.1.2 in /usr/lib/python2.6/site-packages (from awscli)
Collecting botocore==1.2.2 (from awscli)
  Using cached botocore-1.2.2-py2.py3-none-any.whl
Requirement already up-to-date: pyasn1>=0.1.3 in /usr/lib/python2.6/site-packages (from rsa<=3.1.4,>=3.1.2->awscli)
Collecting ordereddict==1.1 (from botocore==1.2.2->awscli)
  Using cached ordereddict-1.1.tar.gz
    /tmp/pip-build-kYyZ1w/ordereddict/setup.py:12: DeprecationWarning: Parameters to load are deprecated.  Call .resolve and .require separately.

(snip...)

  Found existing installation: awscli 1.7.45
    Uninstalling awscli-1.7.45:
      Successfully uninstalled awscli-1.7.45

Successfully installed argparse-1.4.0 awscli-1.8.4 botocore-1.2.2 ordereddict-1.1 simplejson-3.3.0
[ore@server ~]$ aws --version
aws-cli/1.8.4 Python/2.6.6 Linux/2.6.32-504.1.3.el6.centos.plus.x86_64

"I got it ...!"


To summarize briefly, this was resolved by DLing this and running sudo python ez_setup.py! !! (* Reference 3) Thank you Jameel Grand!

I hope this addiction will solve someone's worries.


reference:

  1. http://kaworu.jpn.org/python/pip#.E8.A7.A3.E6.B1.BA.E6.96.B9.E6.B3.95_2
  2. http://blog.gogo-games.com/archives/28446278.html
  3. http://stackoverflow.com/questions/31719816/pip-fails-to-install-anything-error-invalid-command-egg-info

Recommended Posts

Stories and solutions for AWS CLI updates
AWS CLI installation procedure
About "Lamvery", a deployment and management tool for AWS Lambda
Problems and solutions when asked for MySQL db in Python 3
Fight against Japanese filenames: Rubymine, AWS CLI, Docker for Windows (1) --AWS CLI