Aws-cli: Change in 1.11.24 to 1.11.25 breaks in alias_command

Created on 7 Dec 2016  路  19Comments  路  Source: aws/aws-cli

After upgrading from 1.11.24 to 1.11.25 (OS X homebrew), aws no longer starts or shows a help message (the below errors occur regardless of what arguments I provide):

$ aws
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/Cellar/awscli/1.11.25/libexec/lib/python2.7/site-packages/awscli/clidriver.py", line 54, in main
    return driver.main()
  File "/usr/local/Cellar/awscli/1.11.25/libexec/lib/python2.7/site-packages/awscli/clidriver.py", line 186, in main
    command_table = self._get_command_table()
  File "/usr/local/Cellar/awscli/1.11.25/libexec/lib/python2.7/site-packages/awscli/clidriver.py", line 96, in _get_command_table
    self._command_table = self._build_command_table()
  File "/usr/local/Cellar/awscli/1.11.25/libexec/lib/python2.7/site-packages/awscli/clidriver.py", line 116, in _build_command_table
    command_object=self)
  File "/usr/local/lib/python2.7/site-packages/botocore/session.py", line 684, in emit
    return self._events.emit(event_name, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/hooks.py", line 227, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/hooks.py", line 210, in _emit
    response = handler(**kwargs)
  File "/usr/local/Cellar/awscli/1.11.25/libexec/lib/python2.7/site-packages/awscli/customizations/opsworkscm.py", line 21, in alias_opsworks_cm
    alias_command(command_table, 'opsworkscm', 'opsworks-cm')
  File "/usr/local/Cellar/awscli/1.11.25/libexec/lib/python2.7/site-packages/awscli/customizations/utils.py", line 71, in alias_command
    current = command_table[existing_name]
KeyError: 'opsworkscm'

I have tried removing my ~/.aws directory, uninstalling/reinstalling, etc. Happy to provide other info if needed. I rolled back to 1.11.24 via brew and I get the expected help message. Updating to 1.11.25 once more emits the above errors and no help message is emitted.

closing-soon guidance

Most helpful comment

It's happening to me too. installed with pip...

Ubuntu 14.04
Python 2.7.6
pip 9.0.1
awscli==1.11.25
botocore==1.4.5

Update: Strange, I did a sudo pip install 'awscli==1.11.25' --force-reinstall and it removed botocore 1.4.5, replacing it with botocore 1.4.82, and now it works

All 19 comments

+1, same thing here

1.11.26 also broken in the same way. I'm unclear if this is a problem with awscli or with brew's installation of awscli.

I'm using it inside an Ubuntu container, so it's not isolated to brew.

I am unable to reproduce via the bundled installer or brew. Can you do aws --version? It looks like, for some reason, you don't have an up-to-date botocore (hence the lack of the new opsworks-cm service).

$ aws --version
aws-cli/1.11.24 Python/2.7.10 Darwin/16.1.0 botocore/1.4.77

$ brew upgrade awscli
==> Upgrading 1 outdated package, with result:
awscli 1.11.26
==> Upgrading awscli
==> Downloading https://homebrew.bintray.com/bottles/awscli-1.11.26.sierra.bottle.tar.gz
Already downloaded: /Users/scott/Library/Caches/Homebrew/awscli-1.11.26.sierra.bottle.tar.gz
==> Pouring awscli-1.11.26.sierra.bottle.tar.gz
==> Caveats
The "examples" directory has been installed to:
  /usr/local/share/awscli/examples

Before using aws-cli, you need to tell it about your AWS credentials.
The quickest way to do this is to run:
  aws configure

More information:
  https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
  https://pypi.python.org/pypi/awscli#getting-started

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
馃嵑  /usr/local/Cellar/awscli/1.11.26: 3,550 files, 30.9M

$ aws --version
Traceback (most recent call last):
  File "/usr/local/bin/aws", line 27, in <module>
    sys.exit(main())
  ...
  File "/usr/local/Cellar/awscli/1.11.26/libexec/lib/python2.7/site-packages/awscli/customizations/opsworkscm.py", line 21, in alias_opsworks_cm
    alias_command(command_table, 'opsworkscm', 'opsworks-cm')
  File "/usr/local/Cellar/awscli/1.11.26/libexec/lib/python2.7/site-packages/awscli/customizations/utils.py", line 71, in alias_command
    current = command_table[existing_name]
KeyError: 'opsworkscm'

(No version information printed because of the error).

How do I get a new botocore?

$ brew search botocore
No formula found for "botocore".
==> Searching pull requests...
Closed pull requests:
awscli: botocore 1.4.28 (https://github.com/Homebrew/homebrew-core/pull/2034)
awscli 1.10.26 (botocore 1.4.17) (https://github.com/Homebrew/homebrew-core/pull/992)

Same issue. My package versions:
awscli==1.11.28
awsebcli==3.8.7
botocore==1.4.85

Downgrading to 1.11.24 fixed the problem for now. I'm on Linux, tried the installation from both AUR and pip, so I might not be related to homebrew.

It's happening to me too. installed with pip...

Ubuntu 14.04
Python 2.7.6
pip 9.0.1
awscli==1.11.25
botocore==1.4.5

Update: Strange, I did a sudo pip install 'awscli==1.11.25' --force-reinstall and it removed botocore 1.4.5, replacing it with botocore 1.4.82, and now it works

@kevinpauli Tried to force reinstall like you did, didn't work for me. Weird indeed.

Same issue with awscli=1.11.29

@kevinpauli Thanks for posting the fix!

@brhenrique same experience here, force installing to latest did not help. Downgrading to awscli==1.11.24 worked

For brew users, I found that a pip install does seem to fix the problem (may have to sudo for non-brew, global installs). First, unpin awscli, then update it (or remove and install it again), then pip install awscli:

$ brew uninstall awscli
Uninstalling /usr/local/Cellar/awscli/1.11.24... (3,788 files, 33.0M)
$ brew install awscli
==> Downloading https://homebrew.bintray.com/bottles/awscli-1.11.36.sierra.bottle.tar.gz
==> Pouring awscli-1.11.36.sierra.bottle.tar.gz
==> Caveats
...
==> Summary
馃嵑  /usr/local/Cellar/awscli/1.11.36: 3,615 files, 31.7M
$ pip install awscli
Collecting awscli
  Downloading awscli-1.11.36-py2.py3-none-any.whl (1.1MB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 1.1MB 672kB/s
Requirement already satisfied: colorama<=0.3.7,>=0.2.5 in /usr/local/lib/python2.7/site-packages (from awscli)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.9 in /usr/local/lib/python2.7/site-packages (from awscli)
Requirement already satisfied: docutils>=0.10 in /usr/local/lib/python2.7/site-packages (from awscli)
Collecting botocore==1.4.93 (from awscli)
  Downloading botocore-1.4.93-py2.py3-none-any.whl (3.1MB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 3.2MB 272kB/s
Requirement already satisfied: rsa<=3.5.0,>=3.1.2 in /usr/local/lib/python2.7/site-packages (from awscli)
Requirement already satisfied: PyYAML<=3.12,>=3.10 in /usr/local/lib/python2.7/site-packages (from awscli)
Requirement already satisfied: futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from s3transfer<0.2.0,>=0.1.9->awscli)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /usr/local/lib/python2.7/site-packages (from botocore==1.4.93->awscli)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /usr/local/lib/python2.7/site-packages (from botocore==1.4.93->awscli)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/local/lib/python2.7/site-packages (from rsa<=3.5.0,>=3.1.2->awscli)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python2.7/site-packages (from python-dateutil<3.0.0,>=2.1->botocore==1.4.93->awscli)
Installing collected packages: botocore, awscli
  Found existing installation: botocore 1.4.77
    Uninstalling botocore-1.4.77:
      Successfully uninstalled botocore-1.4.77
Successfully installed awscli-1.11.36 botocore-1.4.93
$ aws --version
aws-cli/1.11.36 Python/2.7.13 Darwin/16.3.0 botocore/1.4.93

I did have botocore 1.4.93 installed already, but it was brew's version. Perhaps the old botocore-1.4.77 was getting in the way or was installed in a different path python was searching. At any rate, this worked to update the awscli dependencies when nothing else would.

I ran pip install awscli and it updated botocore and my problem was resolved. I'm running a server based on Amazon's Linux AMI.

Saw a new update to awscli, did pip upgrade to latest, still getting KeyError: 'opsworkscm'. Had to downgrade to awscli==1.11.24 again. This is on Amazon Linux AMI release 2016.09, with latest updates

To downgrade, run as root:

pip install 'awscli==1.11.24' --force-reinstall

Any fix out yet?

The same bug is happening here using latest awscli with the python:2.7 docker container.

@malikolivier Can you share the output of aws --version?

For anyone else still running into this, The opsworkscm command was added in botocore 1.4.81 so if you're running into this issue, ensure you have a version of botocore installed >= 1.4.81. Our setup.py file always points to the latest version of botocore so if you're using pip you shouldn't run into this issue. However you'll need to ensure if you're using some other package manager that they pull in the same version of botocore that matches our setup.py.

If there's anyone still running into this issue with aws --version output that shows a botocore version greater than 1.4.81 and you've installed with pip or our bundled installer, please let us know. This shouldn't be happening and we'll investigate further. Otherwise I think everything's working as expected.

I had the same problem, which i fixed by upgrading the version of botocore
pip install 'botocore==1.5.16'

I'm using awscli from brew and it works fine now.
Thanks @jamesls

I had to upgrade botocore as well, then all was good.
pip install botocore --upgrade

For my part, this problem has been solved outside of the aws-cli. Closing.

Was this page helpful?
0 / 5 - 0 ratings