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

SAM is installed but command cannot be found #2320

Closed
andreaweb opened this issue Oct 22, 2020 · 10 comments
Closed

SAM is installed but command cannot be found #2320

andreaweb opened this issue Oct 22, 2020 · 10 comments

Comments

@andreaweb
Copy link

Description

I've tried installing aws-sam-cli as recommended in the official documentation but it did not work. I've also tried several other methods including npm and pip, but none of them have made the sam command available for me.

Steps to reproduce

I've ran the commands:

brew tap aws/tap
brew install aws-sam-cl

They finish successfully, but trying to run sam --version afterwards displays:

Observed result

Command 'sam' not found, but there are 18 similar ones.

Expected result

Should display sam's version instead.

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

  1. OS: Ubuntu 18.04.5 LTS
  2. sam --version: when I try reinstalling brew tells me it's the latest version... but sam --version still does not work.
@moelasmar moelasmar assigned moelasmar and unassigned moelasmar Oct 27, 2020
@hawflau hawflau added the stage/bug-repro The issue/bug needs to be reproduced label Nov 3, 2020
@hawflau
Copy link
Contributor

hawflau commented Nov 3, 2020

(Edit: added reproduced output)

I managed to reproduce the same Observed result, will investigate

ubuntu@ip-172-31-45-176:~$ brew tap aws/tap
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 3 formulae.

==> Tapping aws/tap
Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/aws/homebrew-tap'...
remote: Enumerating objects: 81, done.
remote: Counting objects: 100% (81/81), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 876 (delta 45), reused 13 (delta 6), pack-reused 795
Receiving objects: 100% (876/876), 174.39 KiB | 8.30 MiB/s, done.
Resolving deltas: 100% (433/433), done.
Tapped 7 formulae (44 files, 336.8KB).
ubuntu@ip-172-31-45-176:~$ brew install aws-sam-cli
==> Installing aws-sam-cli from aws/tap
==> Downloading https://linuxbrew.bintray.com/bottles/gdbm-1.18.1_1.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/dd/dd00a26fa20413f81477af032587de19bb620eef352a6d8dd3d9c3a176f6bd5a?__gda__=exp=1604433745~hmac=28c35e8e3d66bdba62b7c2e7aa1cac2b65f2ca4b371ab6f366ace5520dac9432&response-content-disposition=attachment%3Bfilename%3D%22gdbm-1
######################################################################## 100.0%
==> Downloading https://linuxbrew.bintray.com/bottles/openssl%401.1-1.1.1h.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/61/61bf82b4b62e07589dec1fdc9eb9eb053da01565581fb18dd5df6232182238ec?__gda__=exp=1604433745~hmac=20ecdd3159d8a5a1be219e329f668d82c80ed87c31491acd85d72141343bbde9&response-content-disposition=attachment%3Bfilename%3D%22openss
######################################################################## 100.0%
==> Downloading https://linuxbrew.bintray.com/bottles/ncurses-6.2.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/fc/fc5a0983a8afae8ef46945f3bec9dba9d66e81e879027d100d05088ea6f8043d?__gda__=exp=1604433746~hmac=38b53925fdc6cd665f36dc5141f305b9372b0c32c5fef2ed38266c6aa8adb755&response-content-disposition=attachment%3Bfilename%3D%22ncurse
######################################################################## 100.0%
==> Downloading https://linuxbrew.bintray.com/bottles/readline-8.0.4.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/46/46da47db3da04b2f248e3cf2d6d14c55aa543555d1134f6cbbf07787a5bf0bd6?__gda__=exp=1604433746~hmac=478b2db697a8e4be03c2ebc427012968770ab76efe4df2880d1f37aca4f710b5&response-content-disposition=attachment%3Bfilename%3D%22readli
######################################################################## 100.0%
==> Downloading https://linuxbrew.bintray.com/bottles/sqlite-3.33.0.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/ba/bafd40d3bcbfe8350a04bd65fd2fced3ea98a74b27c6102972eca055d1eca8fe?__gda__=exp=1604433746~hmac=a60c94c8006a648916002292bf42416fea51a0606f8275685cd286036402b5e6&response-content-disposition=attachment%3Bfilename%3D%22sqlite
######################################################################## 100.0%
==> Downloading https://linuxbrew.bintray.com/bottles/xz-5.2.5.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/67/676b0e178b3e7644f86385cb2497ac5ec490e2222ba3d0147e28bd85aff365cf?__gda__=exp=1604433747~hmac=0081c6b817628f089a8b682f552aa185a7dcd2b8b955d70e468eb8b0081f83df&response-content-disposition=attachment%3Bfilename%3D%22xz-5.2
######################################################################## 100.0%
==> Downloading https://linuxbrew.bintray.com/bottles/bzip2-1.0.8.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/e5/e5fce257b9fee119d28d0e7f7dac9332bd26b248fe35d983ba85104243e4bc2e?__gda__=exp=1604433747~hmac=1ae6cb177f8b33b0ba5e7ee0b20a3b71934af2f0cb70e134fc2db63a89fd4d04&response-content-disposition=attachment%3Bfilename%3D%22bzip2-
######################################################################## 100.0%
==> Downloading https://linuxbrew.bintray.com/bottles/libffi-3.3.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://linuxbrew.bintray.com/bottles/unzip-6.0_6.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://linuxbrew.bintray.com/bottles/python%403.8-3.8.6_1.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/5e/5ee32a98b1b9a45c0999f7655a1b5d0ad6336b236ae40bdbc0ff7234387e7f70?__gda__=exp=1604433747~hmac=23f052063d0fd5636b0f1506aeaf30a0c53adf36892fdd057216b77bf83f6436&response-content-disposition=attachment%3Bfilename%3D%22python
######################################################################## 100.0%
==> Downloading https://github.com/aws/aws-sam-cli/releases/download/v1.7.0//aws-sam-cli-1.7.0.x86_64_linux.bottle.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/92205085/21d99b80-1a05-11eb-9a95-8ad348e3c6c4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201103%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201103T195028
######################################################################## 100.0%
==> Installing dependencies for aws/tap/aws-sam-cli: gdbm, openssl@1.1, ncurses, readline, sqlite, xz, bzip2, libffi, unzip and python@3.8
==> Installing aws/tap/aws-sam-cli dependency: gdbm
==> Pouring gdbm-1.18.1_1.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/gdbm/1.18.1_1: 40 files, 1MB
==> Installing aws/tap/aws-sam-cli dependency: openssl@1.1
==> Pouring openssl@1.1-1.1.1h.x86_64_linux.bottle.tar.gz
==> Downloading https://curl.haxx.se/ca/cacert-2020-01-01.pem
######################################################################## 100.0%
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /home/linuxbrew/.linuxbrew/etc/openssl@1.1/certs

and run
  /home/linuxbrew/.linuxbrew/opt/openssl@1.1/bin/c_rehash
==> Summary
🍺  /home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1h: 8,308 files, 23.4MB
==> Installing aws/tap/aws-sam-cli dependency: ncurses
==> Pouring ncurses-6.2.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/ncurses/6.2: 3,901 files, 9.5MB
==> Installing aws/tap/aws-sam-cli dependency: readline
==> Pouring readline-8.0.4.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/readline/8.0.4: 53 files, 1.9MB
==> Installing aws/tap/aws-sam-cli dependency: sqlite
==> Pouring sqlite-3.33.0.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/sqlite/3.33.0: 12 files, 4.9MB
==> Installing aws/tap/aws-sam-cli dependency: xz
==> Pouring xz-5.2.5.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/xz/5.2.5: 128 files, 1.8MB
==> Installing aws/tap/aws-sam-cli dependency: bzip2
==> Pouring bzip2-1.0.8.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/bzip2/1.0.8: 30 files, 549.3KB
==> Installing aws/tap/aws-sam-cli dependency: libffi
==> Pouring libffi-3.3.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/libffi/3.3: 17 files, 552.7KB
==> Installing aws/tap/aws-sam-cli dependency: unzip
==> Pouring unzip-6.0_6.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/unzip/6.0_6: 17 files, 581.8KB
==> Installing aws/tap/aws-sam-cli dependency: python@3.8
==> Pouring python@3.8-3.8.6_1.x86_64_linux.bottle.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.6_1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.6_1/bin --install-lib=/home/linuxbrew/.linuxbrew/lib/python3.8/site-packages --sing
==> /home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.6_1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.6_1/bin --install-lib=/home/linuxbrew/.linuxbrew/lib/python3.8/site-packages --sing
==> /home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.6_1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.6_1/bin --install-lib=/home/linuxbrew/.linuxbrew/lib/python3.8/site-packages --sing
==> Caveats
Python has been installed as
  /home/linuxbrew/.linuxbrew/opt/python@3.8/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /home/linuxbrew/.linuxbrew/opt/python@3.8/libexec/bin

You can install Python packages with
  /home/linuxbrew/.linuxbrew/opt/python@3.8/bin/pip3 install <package>
They will install into the site-package directory
  /home/linuxbrew/.linuxbrew/lib/python3.8/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

python@3.8 is keg-only, which means it was not symlinked into /home/linuxbrew/.linuxbrew,
because this is an alternate version of another formula.

If you need to have python@3.8 first in your PATH run:
  echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/python@3.8/bin:$PATH"' >> ~/.profile

For compilers to find python@3.8 you may need to set:
  export LDFLAGS="-L/home/linuxbrew/.linuxbrew/opt/python@3.8/lib"
  export CPPFLAGS="-I/home/linuxbrew/.linuxbrew/opt/python@3.8/include"

==> Summary
🍺  /home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.6_1: 3,978 files, 73.5MB
==> Installing aws/tap/aws-sam-cli
==> Pouring aws-sam-cli-1.7.0.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/aws-sam-cli/1.7.0: 4,092 files, 99MB
==> No outdated dependents to upgrade!
==> Checking for dependents of upgraded formulae...
==> Reinstalling 1 broken dependent from source:
aws/tap/aws-sam-cli
==> Caveats
==> openssl@1.1
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /home/linuxbrew/.linuxbrew/etc/openssl@1.1/certs

and run
  /home/linuxbrew/.linuxbrew/opt/openssl@1.1/bin/c_rehash
==> python@3.8
Python has been installed as
  /home/linuxbrew/.linuxbrew/opt/python@3.8/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /home/linuxbrew/.linuxbrew/opt/python@3.8/libexec/bin

You can install Python packages with
  /home/linuxbrew/.linuxbrew/opt/python@3.8/bin/pip3 install <package>
They will install into the site-package directory
  /home/linuxbrew/.linuxbrew/lib/python3.8/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

python@3.8 is keg-only, which means it was not symlinked into /home/linuxbrew/.linuxbrew,
because this is an alternate version of another formula.

If you need to have python@3.8 first in your PATH run:
  echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/python@3.8/bin:$PATH"' >> ~/.profile

For compilers to find python@3.8 you may need to set:
  export LDFLAGS="-L/home/linuxbrew/.linuxbrew/opt/python@3.8/lib"
  export CPPFLAGS="-I/home/linuxbrew/.linuxbrew/opt/python@3.8/include"

ubuntu@ip-172-31-45-176:~$ sam

Command 'sam' not found, but there are 18 similar ones.

@hawflau
Copy link
Contributor

hawflau commented Nov 3, 2020

Running brew install aws-sam-cli twice "fixes" the issue as a work-around.
This is the same issue as here and here

@hawflau hawflau added stage/needs-investigation Requires a deeper investigation and removed stage/bug-repro The issue/bug needs to be reproduced labels Nov 3, 2020
@hawflau
Copy link
Contributor

hawflau commented Nov 10, 2020

Further investigation is needed. Meanwhile, a workaround is to run brew install aws-sam-cli twice

@ppottorff
Copy link

You need to symlink it: brew link aws-sam-cli

@aalaap
Copy link

aalaap commented Nov 18, 2020

I had 1.0.0 installed and working fine for months, but after upgrading to the latest (1.10.0) (brew upgrade aws-sam-cli), I got this command not found error. As @hawflau mentioned, running brew install aws-sam-cli after this fixed it for me.

@ronald8192
Copy link

Install, uninstall, then install again works for me (Ubuntu 20):

brew install aws-sam-cli
brew uninstall aws-sam-cli
brew install aws-sam-cli

@krrenjith
Copy link

Issue persist with Homebrew 2.7.1 and brew install twice fixes the issue. During first install getting following logs.

==> Installing aws/tap/aws-sam-cli
==> Pouring aws-sam-cli-1.15.0.x86_64_linux.bottle.tar.gz
🍺 /home/ec2-user/.linuxbrew/Cellar/aws-sam-cli/1.15.0: 3,951 files, 87.9MB
==> No outdated dependents to upgrade!
==> Checking for dependents of upgraded formulae...
==> Reinstalling 1 broken dependent from source:
aws/tap/aws-sam-cli
==> Caveats
==> openssl@1.1

However, the path /home/ec2-user/.linuxbrew/Cellar/aws-sam-cli/1.15.0 did not exist. The actual path getting created was /home/ec2-user/.linuxbrew/Cellar/aws-sam-cli/1.15.0.reinstall

After second run of brew install, /home/ec2-user/.linuxbrew/Cellar/aws-sam-cli/1.15.0 gets created and everything works as expected.

@xazhao
Copy link
Contributor

xazhao commented Sep 1, 2021

Verified this issue is gone with following environments:
Homebrew: 3.2.10
SAM CLI: 1.29.0
EC2 Ubuntu 18.04.5

If there are further questions, feel free to reopen this.

@xazhao xazhao closed this as completed Sep 1, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@zmanhcong
Copy link

i had the same problem with windows 11, i fixed it by below

  1. Try uninstalling and reinstalling the SAM CLI. You can do this by running the following commands:
pip uninstall aws-sam-cli
pip install aws-sam-cli
  1. Check the version of Python you're using. The SAM CLI requires Python 3.6 or later. You can check your Python version by running the command python --version. If you're using an earlier version of Python, you'll need to upgrade to a later version.

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

No branches or pull requests

9 participants