okta-aws-cli-assume-role: Windows 10 Error - Cannot run program "aws"
After installing the aws cli through python, I attempt to run awscli.bat, and get the following error:
Exception in thread "main" java.io.IOException: Cannot run program "aws": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at com.okta.tools.awscli.main(awscli.java:36)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 2 more
My initial guess was an issue with the way my PATH variable was setup, but running aws from the command line resolves correctly, and it also looks like the correct directory C:\Program Files\Python36\Scripts has been added to the PATH.
Can you all identify anything that I may have missed in order to execute this command correctly?
Below is execution of aws from Powershell with Admin access. The same result also occurs from my user-level account.
PS C:\> aws
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: the following arguments are required: command
This is a snapshot of my system-level environment variables. I have included the Python paths in both User and System.

About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 25 (1 by maintainers)
Commits related to this issue
- :bug: AWS command filename isn't always "aws" - Use Get-Command to get the real filename of the aws command Resolves #85 — committed to AlainODea/okta-aws-cli-assume-role by AlainODea 6 years ago
It seems that Windows users need to install the AWS CLI using the MSI Installer. The Okta AWS CLI Assume Role tool does not work with the AWS CLI installed using
pip.@testworksau you’re right
Changing this: https://github.com/oktadeveloper/okta-aws-cli-assume-role/blob/eb6904319026f09f0c2710f5d6c819653cc32cd5/bin/Install-OktaAwsCli.ps1#L85 To this:
Fixes the issue solidly regardless of whether the command file is aws or aws.cmd.
Sure. I’ll have some time this week. 👍
Looking into this a bit further, it looks like there is a bug which causes okta-aws-cli-assume-role to fail when using python3 and aws-cli. @AlainODea @dlgoodr
How to Reproduce
Notes
Totally disagree.
awsclifrom pip on Windows works marvelously in all cases except for when used by okta-aws-cli-assume-role. The fact that the tool can’t support this use case is still a defect.@mraible this can be closed. It’s an unrelated issue due to installing AWSCLI using PIP which doesn’t really work on Windows.