Aws-sam-cli: sam --version doesn't work

Created on 31 May 2018  路  5Comments  路  Source: aws/aws-sam-cli

Description:
I am using python 2.7 in Windows
I did pip install --user aws-sam-cli, and then I do pip list, I can see aws-sam-cli has version 0.3.0.
However, when I do sam --version in cmd, I got:
_'sam' is not recognized as an internal or external command,
operable program or batch file._
I think it is environment variable path issue, but I don't know which path to put there.
Steps to reproduce the issue:
1.
2.
3.

Observed result:

Expected result:

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

Output of sam --version:

Optional Debug logs:

Add --debug flag to command you are running

Most helpful comment

I'm currently having the issue that Git Bash doesn't seem to natively know how to find executables with a ".cmd" file extension, even if they are in the path. :/

create an alias,

$ alias sam='sam.cmd'

All 5 comments

You should be setting the PATH in your machine to the installation of SAM CLI. See https://github.com/awslabs/aws-sam-cli#general-issues

Feel free to re-open if this doesn't work

sanathkr, could you please shed some light on how to set the PATH to the installation of SAM CLI? the sentence "in Windows systems the command py -m site --user-site typically print %APPDATA%\Roaming\Python\site-packages, so you'll need to remove the last \site-packages folder and replace it with the \Scripts one." is not really helpful to me.

I tried adding the path in my environment variables. Didn't work

I tried running these commands in my Windows Command Prompt. Didn't work
`# Find your Python User Base path (where Python --user will install packages/scripts)
$ USER_BASE_PATH=$(python -m site --user-base)

# Update your preferred shell configuration
## Standard bash --> ~/.bash_profile
## ZSH --> ~/.zshrc
$ export PATH=$PATH:$USER_BASE_PATH/bin`

Am I doing something wrong?

EDIT: [SOLVED] When I added the path "C:\Users\User\AppData\Roaming\Python\Python36\Scripts", I haven't actually changed the "User" to my username. Very silly and very painful.

If I may be so bold, where is SAM CLI installed at?

I seem to already have the python/scripts folder in my path but still get a

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

when trying the --version.

EDIT: [SOLVED] Found it here: C:\Program Files\Amazon\AWSSAMCLI\runtime\Scripts\sam.exe

For me, it's at /c/Program\ Files/Amazon/AWSSAMCLI/bin/sam.cmd (or c:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd, if you're using that filespec)

(I do have the file that @markthegrea mentions, but executing it yields "failed to create process". I installed sam via instructions and the windows installer at: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-windows.html)

I'm currently having the issue that Git Bash doesn't seem to natively know how to find executables with a ".cmd" file extension, even if they are in the path. :/

I'm currently having the issue that Git Bash doesn't seem to natively know how to find executables with a ".cmd" file extension, even if they are in the path. :/

create an alias,

$ alias sam='sam.cmd'

Was this page helpful?
0 / 5 - 0 ratings