aws-shell icon indicating copy to clipboard operation
aws-shell copied to clipboard

Support AWS CLI v2

Open nathaniel-holder opened this issue 5 years ago • 43 comments

Hello,

When using AWS CLI v2, I get this error: 'Namespace' object has no attribute 'cli_binary_format' On Windows 10, Python 3.8.1

AWS CLI v2 reference: https://aws.amazon.com/blogs/developer/aws-cli-v2-is-now-generally-available/

Thanks!

nathaniel-holder avatar Feb 19 '20 19:02 nathaniel-holder

I have same issue. After update aws-cli, aws-shell does not works.

Environment: os: macOS 10.15.3 awscli: aws-cli/2.0.0 Python/3.8.1 Darwin/19.3.0 botocore/2.0.0dev4 (installed by homebrew) aws-shell: 0.2.1 (installed by homebrew)

image

xhiroga avatar Feb 24 '20 07:02 xhiroga

Same problem for me on macOS and with awscli installed via Homebrew:

$ aws --version
aws-cli/2.0.0 Python/3.8.2 Darwin/19.3.0 botocore/2.0.0dev7

If I use the pip installed module it works without issues:

$ python3 -m awscli --version
aws-cli/1.18.20 Python/3.7.7 Darwin/19.3.0 botocore/1.15.20

vitorbrandao avatar Mar 13 '20 12:03 vitorbrandao

Is this project abandoned?

bwhaley avatar Mar 17 '20 16:03 bwhaley

Even I am facing the same issue. Environment OS - macOS 10.15.4 AWS - aws-cli/2.0.8 Python/3.8.2 Darwin/19.4.0 botocore/2.0.0dev12

dushyantRathore avatar Apr 23 '20 12:04 dushyantRathore

Do we have plans to maintain this? I was relying holistically on this until cli 2.0 happened 😐

gauravdingolia avatar Apr 23 '20 16:04 gauravdingolia

Any idea how to fix it? Run any command got this error.

$ aws-shell Creating doc index in the background. It will be a few minutes before all documentation is available. aws> configure

'Namespace' object has no attribute 'cli_binary_format'

yongkanghe avatar May 01 '20 10:05 yongkanghe

Encountered the same problem. I am running WSL 18.04

I solved it by upgrading both the awscli and aws-shell together via pip

pip install -U awscli aws-shell

Hope this can be helpful for other people.

xinbinhuang avatar May 19 '20 17:05 xinbinhuang

Encountered the same problem. I am running WSL 18.04

I solved it by upgrading both the awscli and aws-shell together via pip

pip install -U awscli aws-shell

Hope this can be helpful for other people.

It fixed the issues. Thanks Xinbin!

yongkanghe avatar May 20 '20 01:05 yongkanghe

I solved it by upgrading both the awscli and aws-shell together via pip

That's perhaps because pip install awscli installs awscli v1 (1.18.69 as of today)

  • https://pypi.org/project/awscli/

nodakai avatar May 31 '20 16:05 nodakai

Encountered the same problem. I am running WSL 18.04

I solved it by upgrading both the awscli and aws-shell together via pip

pip install -U awscli aws-shell

Hope this can be helpful for other people.

Did not work for me.

pujansrt avatar Jun 02 '20 10:06 pujansrt

I ran into this same issue, unfortunately, and as stated by someone else it appears as though installing both the awscli and the aws-shell together would not work because that would not currently install the awscli v2. I am on Arch Linux and I installed the awscli via these steps.

tdfacer avatar Jun 04 '20 14:06 tdfacer

Did not work also on Win10 Arch and awscli v2. Anyone who have the same problem

fopingn avatar Jun 08 '20 14:06 fopingn

I am experiencing the same. By the look at this repository, all development was done in mid 2016 with some contributions in 2018, so I guess it is safe to assume that this project died (unless someone picks it up)

petrmvala avatar Jun 21 '20 19:06 petrmvala

Managed to get aws-shell running ok in a fresh virtual environment using:

aws-shell==0.2.1
awscli==1.18.91

Suspect this is related to AWS CLI version 2

C-Kenny avatar Jun 30 '20 22:06 C-Kenny

I am also facing the same issue. I am unable to perform any actions. I always get 'Namespace' object has no attribute 'cli_binary_format'

I am using:

AWS CLI Version: aws-cli/2.0.19 Python/3.7.7 Windows/10 botocore/2.0.0dev23

vigneshbrb avatar Jul 02 '20 11:07 vigneshbrb

Encountered the same problem. I am running WSL 18.04

I solved it by upgrading both the awscli and aws-shell together via pip

pip install -U awscli aws-shell

Hope this can be helpful for other people.

This worked for me, thanks a lot.

kosmur avatar Jul 17 '20 10:07 kosmur

Encountered the same problem. I am running WSL 18.04 I solved it by upgrading both the awscli and aws-shell together via pip

pip install -U awscli aws-shell

Hope this can be helpful for other people.

This worked for me, thanks a lot.

I have tried but it does not work. AWS CLi reverts back to 1.x version Could you check again if you are running now 2.0 in awscli.

aws --version

psrivastava-rsc avatar Jul 17 '20 11:07 psrivastava-rsc

Hi Guys,

After reading the information from this thread, I guess the root cause is awscli version conflict; aws-shell believes that you are using awscli version 1 that cli_binary_format is not supported; your system has both 2 versions and the command is executed with awscli version 2 which cli_binary_format could be mandatory.

The solution is cleaning up all version of awscli and aws-shell in your system, then reinstall them. That solved my issue.

Good luck, Kent

Truscle avatar Jul 23 '20 04:07 Truscle

What are your installation commands for re-installing. Still Ihave no luck

psrivastava-rsc avatar Jul 23 '20 06:07 psrivastava-rsc

I have same problem on macOS v10.15.6.

[ chusiang@catalina ~ ] - 17:20
$ brew install awscli

[ chusiang@catalina ~ ] - 17:39
$ aws --version
aws-cli/2.0.33 Python/3.8.5 Darwin/19.5.0 botocore/2.0.0dev37

I will use the aws-shell command via Docker, I give up to fix this problem now. 😂

https://hub.docker.com/r/pahud/aws-shell

[ chusiang@catalina ~ ] - 17:49
$ docker run -it --rm -v $HOME/.aws:/root/.aws pahud/aws-shell
First run, creating autocomplete index...
Creating doc index in the background. It will be a few minutes before all documentation is available.
aws> s3 ls
2020-06-27 15:15:25 fooooooo
aws>

By the way, I also add one alias to disguise the aws-shell command.

$ echo "alias aws-shell='docker run -it --rm -v $HOME/.aws:/root/.aws pahud/aws-shell'" >> ~/.bash_aliases

Thanks for @pahud .

chusiang avatar Jul 23 '20 09:07 chusiang

Is this project abandoned or not?

tomaszdudek7 avatar Jul 27 '20 09:07 tomaszdudek7

Thanks @chusiang. Since I'm using aws-vault to store my Access Keys/Secret Keys instead of ~/.aws/credentials, I improved your alias by passing AWS_* environment variables to the container, and turned it into a wrapper script:

#!/bin/bash

function cleanup() {
    rm "${env_file}"
}

trap cleanup EXIT

env_file=$(mktemp)
env | grep ^AWS_ > "${env_file}"

docker run -it --rm -v $HOME/.aws:/root/.aws --env-file="${env_file}" pahud/aws-shell

dserodio avatar Jul 27 '20 17:07 dserodio

I fixed in Win10 by selecting in my PATH the AWS CLI v1.x. C:\Program Files\Amazon\AWSCLI

AWS CLI V2.x uses C:\Program Files\AWSCLIV2

So how do we get support for AWS CLI V2.x?

rcalvachi avatar Aug 01 '20 04:08 rcalvachi

you can fix with installing awscli@1 and changing your path:

brew install awscli@1 echo 'export PATH="/usr/local/opt/awscli@1/bin:$PATH"' >> ~/.zshrc

(change zshrc to whatever your shell is...)

benoitm974 avatar Aug 17 '20 09:08 benoitm974

After reading the information from this thread, I guess the root cause is awscli version conflict; aws-shell believes that you are using awscli version 1 that cli_binary_format is not supported; your system has both 2 versions and the command is executed with awscli version 2 which cli_binary_format could be mandatory.

The solution is cleaning up all version of awscli and aws-shell in your system, then reinstall them. That solved my issue.

Hi Guys,

Please allow me to elaborate a bit what happened in macOS environment.

  1. Brew will install awscli v2 and a bunch of other components, including python 3, to /usr/local/Cellar. And create system links in /usr/local/bin etc.
  2. When using pip to install aws-shell, awscli (only v1 is available at the monment) etc., they will be installed in somewhere like $YOUR_PYTHON_HOME/3.8.5/lib/python3.8/site-packages.
  3. When executing aws --version, depends on your $PATH setting because your system have got 2 versions of awscli now, the system could use the version installed via brew. That's why you see version 2.x.x printed.
  4. When executing aws-shell, the aws-shell will load the awscli module installed within the same site-packages, which is awscli v1. That means aws-shell believes that he is interacting with version 1, thus he should not use cli_binary_format parameter.
  5. However, when you execute any aws command in aws-shell, e.g. s3 ls, aws-shell will call aws command to do the job. Now, please refer to #3 above. That means the aws-shell could be calling the awscli version 2 which requires the cli_binary_format parameter. That's why the 'Namespace' object has no attribute 'cli_binary_format' error occurred.

tips: execute sudo find / -name python to see where they are.

Gook luck, Kent

Truscle avatar Aug 23 '20 01:08 Truscle

still hopeful that aws-shell isn't going away anytime soon and gets support for AWS CLI v2 ❤️

in the meantime based other examples given here I too have resorted to just using a docker container for aws-shell and have aws-vault handling auth by passing in an --env-file directly:

alias aws-shell-prod="docker run -it --rm -v $HOME/.aws:/root/.aws -v $PWD:/workspace --env-file <(aws-vault exec production -- env | grep ^AWS_) -w /workspace pahud/aws-shell"

thanks to @pahud @chusiang @dserodio

shanedroid avatar Sep 23 '20 18:09 shanedroid

AWS have added auto-prompt mode to CLI v2, so aws-shell is not required unless you still need v1. See https://github.com/aws/aws-cli/issues/5664

MikeLim7 avatar Dec 16 '20 13:12 MikeLim7

Here is my solution and hopefully it will work. The issue in my case arises because of aws-shell in a different directory

Note- When we installed any package via HomeBrew, it put the package inside the .linuxbrew (hidden directory) which is separate from your $HOME dir.

See the image below. image

Step1: Find the aws-shell directory via which aws-shell (In my case it was inside this /home/linuxbrew/.linuxbrew/bin earlier) image

Step2: Once you find the directory, prefer to create a folder where you can put all the packages together. That can either be in /usr/bin or create your own ( In my case I put inside the /usr/local/bin)

image You can see I've got a bunch of other packages such as Ansible, terraform etc.

Step3: For Ubuntu users, find your .bashrc file and provide the path into it. Similar, other operating systems (such as windows, mac etc) can find their shell-script file and add the path.

image

(Additional Note- .bashrc is a shell script that Bash runs whenever it is started interactively. It initializes an interactive shell session. You can put any command in that file that you could type at the command prompt. )

Don't forget to reload the .bashrc. To run refresh the .bashrc file, simply go to your $HOME yourterminal~$ . .bashrc (run dot-space-dotbashrc)

Voila it's working 👍🏻 image

Hope this helps :)

imoisharma avatar Jan 03 '21 07:01 imoisharma

same issue windows keeps reverting cli back to v1

dangolbeeker avatar Jan 16 '21 18:01 dangolbeeker

I am happy with v2's auto-prompt mode as described at https://github.com/aws/aws-cli/issues/5664

export AWS_CLI_AUTO_PROMPT=on
aws  # This will immediately enter auto-prompt mode

MikeLim7 avatar Jan 17 '21 00:01 MikeLim7