Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AWS CLI v2 #238

Open
nathaniel-holder opened this issue Feb 19, 2020 · 43 comments
Open

Support AWS CLI v2 #238

nathaniel-holder opened this issue Feb 19, 2020 · 43 comments

Comments

@nathaniel-holder
Copy link

nathaniel-holder commented Feb 19, 2020

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!

@xhiroga
Copy link

xhiroga commented Feb 24, 2020

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

@vitorbrandao
Copy link

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

@bwhaley
Copy link

bwhaley commented Mar 17, 2020

Is this project abandoned?

@dushyantRathore
Copy link

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

@gauravdingolia
Copy link

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

@yongkanghe
Copy link

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'

@xinbinhuang
Copy link

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.

@yongkanghe
Copy link

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!

@nodakai
Copy link

nodakai commented May 31, 2020

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)

@pujansrt
Copy link

pujansrt commented Jun 2, 2020

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.

@tdfacer
Copy link

tdfacer commented Jun 4, 2020

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.

@fopingn
Copy link

fopingn commented Jun 8, 2020

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

@petrmvala
Copy link

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)

@C-Kenny
Copy link

C-Kenny commented Jun 30, 2020

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

@vigneshbrb
Copy link

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

@kosmur
Copy link

kosmur commented Jul 17, 2020

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.

@psrivastava-rsc
Copy link

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

@Truscle
Copy link

Truscle commented Jul 23, 2020

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

@psrivastava-rsc
Copy link

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

@chusiang
Copy link

chusiang commented Jul 23, 2020

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 .

@tomaszdudek7
Copy link

Is this project abandoned or not?

@dserodio
Copy link

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

@rcalvachi
Copy link

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?

@benoitm974
Copy link

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...)

@Truscle
Copy link

Truscle commented Aug 23, 2020

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 Make CLI command renames data driven #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

@shanedroid
Copy link

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

@MikeLim7
Copy link

MikeLim7 commented Dec 16, 2020

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

@imoisharma
Copy link

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 :)

@dangolbeeker
Copy link

same issue windows keeps reverting cli back to v1

@MikeLim7
Copy link

MikeLim7 commented Jan 17, 2021

I am happy with v2's auto-prompt mode as described at aws/aws-cli#5664

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

@angryjenkins
Copy link

tagging to follow this as well - enjoyed using aws-shell more than awscli, ... however work requires cli v2.

@gimbo
Copy link

gimbo commented Mar 26, 2021

@angryjenkins You don't need to comment in order to be informed about updates to an issue: just hit the subscribe button.

@rahulitnetwork
Copy link

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

remove awscli v2 and use this command "pip install -U awscli aws-shell" it will work

@randonia
Copy link

randonia commented Jul 12, 2021

Anyone landing here, I was able to fix it for myself (OSX Catalina 10.15.7) by force installing awscli@1 in with homebrew

# previously installed with just "brew install awscli"
❯ aws --version
aws-cli/2.2.18 Python/3.9.6 Darwin/19.6.0 source/x86_64 prompt/off
❯ aws-shell
aws> configure list
(failure output)
^D

❯ brew install awscli@1
Updating Homebrew...
(lots of output)
# for some reason this is the same
❯ aws --version
aws-cli/2.2.18 Python/3.9.6 Darwin/19.6.0 source/x86_64 prompt/off
❯ aws-shell
aws> configure list
(successful output)

Might not be ideal, but it at least works today

@imoisharma
Copy link

Can we close this issue now @nathaniel-holder? If it resolved the issue? cc @awslabs

@nathaniel-holder
Copy link
Author

Can we close this issue now @nathaniel-holder? If it resolved the issue? cc @awslabs

Fine with me @imoisharma, if it's true that CLI v2 supports aws-shell features. I don't have the bandwidth to verify that right now.

@jcasadella
Copy link

Can we close this issue now @nathaniel-holder? If it resolved the issue? cc @awslabs

Fine with me @imoisharma, if it's true that CLI v2 supports aws-shell features. I don't have the bandwidth to verify that right now.

Hi there! I've executed the steps proposed by @randonia but for me, the issue persists 😞

Here are my steps (running on OSX Big Sur 11.5):

# previously installed with just "brew install awscli
> aws --version
aws-cli/2.2.28 Python/3.9.6 Darwin/20.6.0 source/x86_64 prompt/off
> aws-shell
aws> s3 ls
'Namespace' object has no attribute 'cli_binary_format'
^D

> brew install awscli@1
...
==> Summary
🍺  /usr/local/Cellar/awscli@1/1.20.10: 11,559 files, 79.8MB
# still the same aws version as @randonia pointed out
> aws --version
aws-cli/2.2.28 Python/3.9.6 Darwin/20.6.0 source/x86_64 prompt/off
# But when doing an s3 ls the shell crashes
> aws-shell
aws> s3 ls
'Namespace' object has no attribute 'cli_binary_format'

# With the aws command, the `s3 ls` works correctly:
> aws s3 ls
(list of buckets...)

@psrivastava-rsc
Copy link

This issue persists

@kyleknap
Copy link

kyleknap commented Aug 13, 2021

@nathaniel-holder The AWS CLI v2 makes AWS Shell features available through its auto-prompt feature. We have the relationship between the AWS Shell and auto-prompt mode detailed here: #253. The auto-prompt functionality is fairly well illustrated in this issue: aws/aws-cli#5664 and in a re:Invent talk I presented that covered it.

While auto-prompt mode has some features that the AWS Shell does not (e.g. output panel), the most notable gap in functionality in auto-prompt mode when compared to the AWS Shell is that it does not offer a persistent shell for running CLI commands. We have a GitHub features open tracking the addition of an explicit shell mode (e.g., aws shell command) directly into v2: aws/aws-cli#5665

In terms of this GitHub issue, I'd prefer to close it in favor of the issue tracking the addition of an explicit shell mode built into the AWS CLI v2 for reasons similar to why we launch auto-prompt mode directly in v2: #253.

Thoughts? For those tracking this issue:

  1. If you want a shell mode even with auto-prompt mode in the AWS CLI v2, add the 👍 reaction to the v2 tracking issue for an explicit shell mode: [v2][auto-prompt] Shell mode for AWS CLI auto-prompt  aws/aws-cli#5665.
  2. If you do not want this issue to be closed in favor of [v2][auto-prompt] Shell mode for AWS CLI auto-prompt  aws/aws-cli#5665, please comment why.

@merps
Copy link

merps commented Aug 16, 2021

FWIW - new mbp 13" (macOS Big Sur 11.5.2) and functioning as per @randonia suggestion:

# from previous before suggested, depreciated, fix:
➜  /Users aws --version 
aws-cli/2.2.29 Python/3.9.6 Darwin/20.6.0 source/x86_64 prompt/off

# Installation of previous build:
➜  ~ brew install awscli@1
Updating Homebrew...
Warning: awscli@1 1.20.10 is already installed and up-to-date.
To reinstall 1.20.10, run:
  brew reinstall awscli@1

# export as per homebrew directions for precedent processing:
➜  ~ echo 'export PATH="/usr/local/opt/awscli@1/bin:$PATH"' >> ~/.zshrc

# source environment to refresh current shell:
➜  ~ source ~/.zshrc

# validation of environment reload:
➜  ~ env | grep PATH
PATH=/usr/local/opt/awscli@1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 

# validation of path precedents:
➜  ~ aws --version
aws-cli/1.20.10 Python/3.9.6 Darwin/20.6.0 botocore/1.21.10

# Testing of aws-shell:
➜  ~ aws-shell 
aws> ec2 describe-vpcs
{
    "Vpcs": [
        {
            "CidrBlock": "10.0.0.0/16",
            "DhcpOptionsId": "dopt-xxxxxx",
            "State": "available",
            "VpcId": "vpc-xxxxxxxxxxxx",
            "OwnerId": "xxxxxxxxxxxxxx",
            "InstanceTenancy": "default",
            "CidrBlockAssociationSet": [
                {
                    "AssociationId": "vpc-cidr-assoc-xxxxxxxxxxxx",
                    "CidrBlock": "10.0.0.0/16",
                    "CidrBlockState": {
                        "State": "associated"
                    }
                }
            ],

removed id's due to internal AWS account usage

Hopefully this help some-else bridge the gap until [v2][auto-prompt] Shell mode for AWS CLI auto-prompt

be well all...

@cjhodges77
Copy link

Any update on this? I'm still getting the error with version 2

@DrDiman
Copy link

DrDiman commented Jan 25, 2022

u can use cli v2 as aws --cli-auto-prompt

or u can set cli_auto_prompt = on in the aws cli config and aws command will prompt u everything)

@qzeeshan
Copy link

Yes, I can confirm that it seems like they've embedded shell into cli from v2.0.

It was giving me issues as well, but when I ran auto_prompt ON, cli is now working as shell and that error ['Namespace' object has no attribute 'cli_binary_format'] is gone...

github_comment_aws_cli_v2 2

Thanks @DrDiman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests