Aws-toolkit-jetbrains: Unable to configure AWS CLI

Created on 10 Dec 2018  路  9Comments  路  Source: aws/aws-toolkit-jetbrains

Describe the bug
I'm testing out the AWS/PyCharm Toolkit on my MacBook as described here: https://aws.amazon.com/blogs/aws/new-aws-toolkits-for-pycharm-intellij-preview-and-visual-studio-code-preview/

I've gotten to the point where I'm trying to deploy the "hello world" app to AWS, but I'm getting the following error: Error: Unable to find AWS CLI installation under following names: ['aws']

In my PyCharm project, I have a Virtualenv set up for my Interpreter, which has both my awscli and aws-sam-cli installed via Pip. I have the SAM CLI executable pointing to my Virtualenv correctly (/Users/epost/.python/venv/bin/sam) in "Tools-->AWS", but I can't seem to find where to configure awscli. Where is this accomplished?

To reproduce
Configure as described here: https://aws.amazon.com/blogs/aws/new-aws-toolkits-for-pycharm-intellij-preview-and-visual-studio-code-preview/

Expected behavior
Able to configure awscli during setup just like the SAM ClI can be configured

Screenshots
N/A

Your Environment

  • OS: MacOS 10.14
  • JetBrains' Product: PyCharm Professional Edition
  • JetBrains' Product Version: 2018.3
  • Toolkit Version: N/A

Additional context
N/A

guidance

Most helpful comment

Okay, I figured it out. In my .bash_profile, I had included the "~" character instead of spelling out my home directory. This produced inconsistent results, including SAM not being able to find the 'aws' command. Spelling out the home directory fixed the issues.

All 9 comments

Sam always looks for the AWS cli on your path, not in your virtual env.

Same issue.
I can run both 'aws' and 'sam' successfully.
When trying to run 'sam package' I get:
Error: Unable to find AWS CLI installation under following names: ['aws']

@AdamShechter9 SAM CLI requires the AWS CLI to be on the path, not in the same virtual env

I meet a similar issue, as a reference. Even I placed aws and sam cli tool in /usr/local/bin, the aws-toolkit plugin still failed by command not find issue. I'm considering if there is a bug which causes the plugin didn't get the right PATH var environment correctly, or "outside" didn't pass the path in by such code explore (pls correct me if i'm wrong).

I checked the code at [0], the executable_search_paths list will be empty/None for the java maven (my case) manifest workflow, and finally os.defpath will be used for the binary search by the logic at [1], I tried to provided the correct PATH by bash (.bashrc), paths (/etc/paths or /etc/paths.d/), or Path Variables config for IDEA, but all don't work.

BTW, finally I fixed my similar issue by creating link files of aws and sam in the /usr/bin - default PATH, and System Integrity Protection need to be disabled by csrutil disable && reboot.

[0] https://github.com/awslabs/aws-sam-cli/blob/v0.13.0/samcli/lib/build/workflow_config.py#L49
[1] https://github.com/awslabs/aws-lambda-builders/blob/v0.2.1/aws_lambda_builders/utils.py#L108-L116

The PATH that the SAM CLI looks at should be inherited from IntelliJ/PyCharm's environment getter, which is run once at startup, so if PATH is changed while the IDE is open, you'll have to restart your IDE for changes to take effect.

I'm unsure how the AWS CLI would not be found since /usr/local/bin should be in the default PATH.

I have the same issue (on Mac OS), and I've noticed something odd. If I type in the command "aws", it will work, but if I type in "which aws" the command doesn't return anything. I'm not sure how to interpret this, but I think it's important. Adding this for future reference or to help others.

Okay, I figured it out. In my .bash_profile, I had included the "~" character instead of spelling out my home directory. This produced inconsistent results, including SAM not being able to find the 'aws' command. Spelling out the home directory fixed the issues.

SAM CLI requires the AWS CLI to be on the path, not in the same virtual env

In Windows 10, I created a virtual env, activated it from the command line, and then installed _aws_ and _sam_ CLIs with pip. While in this env both _sam_ and _aws_ work fine (I am able to init, invoke local, package, deploy and delete the SAM application), using PyCharm and the aws-toolkit am able to build and invoke/debug the lambda function locally (provided that build inside a container is activated), but the deploy phase fails with the error:

"'aws.cmd' is not recognized as an internal or external command, operable program or batch file."

@abrooksv - from your comments I understand that the problem is that _sam_ is looking for the _aws_ tool in the (system) path, but once the virtual env is active the ("patched") path contains both sam and aws (and from the command line all works fine), wouldn't be a more consistent behaviour if the toolkit uses the virtual env path? The whole point of venvs is to sandbox libs and (possibly) tools, forcing the user to install sam and aws globally wouldn't break the venvs benefits?

brew install awscli worked for me as I have sam installed via brew too.

Was this page helpful?
0 / 5 - 0 ratings