aws-sam-cli: Error installing aws-sam-cli

Error installing aws-sam-cli

Could not find a version that satisfies the requirement serverlessrepo==0.1.5 (from aws-sam-cli)

Steps to reproduce

  1. Enter sudo pip3 install --user aws-sam-cli or sudo pip3 install --user --upgrade aws-sam-cli

Observed result

The directory '/home/israel/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/israel/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting aws-sam-cli
  Downloading https://files.pythonhosted.org/packages/c3/7c/79463add5772a98f044fab3024c27db61550bb1d9bbd06a715e3c3dc6b2a/aws_sam_cli-0.10.0-py3-none-any.whl (423kB)
    100% |████████████████████████████████| 430kB 1.6MB/s 
Requirement already satisfied: Flask~=1.0.2 in /usr/local/lib/python3.5/dist-packages (from aws-sam-cli) (1.0.2)
Collecting dateparser~=0.7 (from aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/ac/9e/1aa87c0c59f9731820bfd20a8b148d97b315530c2c92d1fb300328c8c42f/dateparser-0.7.0-py2.py3-none-any.whl (357kB)
    100% |████████████████████████████████| 358kB 1.4MB/s 
Collecting serverlessrepo==0.1.5 (from aws-sam-cli)
  Could not find a version that satisfies the requirement serverlessrepo==0.1.5 (from aws-sam-cli) (from versions: 0.1.6)
No matching distribution found for serverlessrepo==0.1.5 (from aws-sam-cli)

Expected result

Successful Installation

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

  1. OS: Ubuntu 16.04
  2. sam --version: n/a

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

I faced the same error on Python 3.5.2. I switched to python 3.7 instead and the installation succeeded with the following command: python3.7 -m pip install aws-sam-cli

SAM CLI supports Python2.7, 3.6, and 3.7. If you elect to install through pip instead of one of our installers (installers are preferred) then the python version you install into must be one of our supported versions.

I ran brew reinstall aws-sam-cli after following the process and got a successful download.

Output:

==> Reinstalling aws/tap/aws-sam-cli 
==> Downloading https://files.pythonhosted.org/packages/2d/47/618e89211a10c3fc007949f84e88544722e8f9e43299ed28f188891e53fa/aws-sam-cli-0.10.0.tar.gz
Already downloaded: /home/israel/.cache/Homebrew/downloads/c9038134ec8dbf4e1ebdb3491ab530a6198d809d15c5cbe600bcfa08b72e9a34--aws-sam-cli-0.10.0.tar.gz
==> Downloading https://files.pythonhosted.org/packages/4e/8b/75469c270ac544265f0020aa7c4ea925c5284b23e445cf3aa8b99f662690/virtualenv-16.1.0.tar.gz
Already downloaded: /home/israel/.cache/Homebrew/downloads/bda8bcde19a275fd9c84a7ec957593976e90dfd0e461a87f5698f1d2286c0197--virtualenv-16.1.0.tar.gz
==> python3 -c import setuptools... --no-user-cfg install --prefix=/tmp/aws-sam-cli--homebrew-virtualenv-20190109-15806-124lipt/target --install-scrip
==> python3 -s /tmp/aws-sam-cli--homebrew-virtualenv-20190109-15806-124lipt/target/bin/virtualenv -p python3 /home/israel/.linuxbrew/Cellar/aws-sam-cl
==> /home/israel/.linuxbrew/Cellar/aws-sam-cli/0.10.0/libexec/bin/pip install -v --no-binary :all: --ignore-installed /tmp/aws-sam-cli-20190109-15806-
==> /home/israel/.linuxbrew/Cellar/aws-sam-cli/0.10.0/libexec/bin/pip uninstall -y aws-sam-cli
==> /home/israel/.linuxbrew/Cellar/aws-sam-cli/0.10.0/libexec/bin/pip install -v --no-deps --no-binary :all: --ignore-installed /tmp/aws-sam-cli-20190
🍺  /home/israel/.linuxbrew/Cellar/aws-sam-cli/0.10.0: 5,558 files, 71.6MB, built in 5 minutes 52 seconds

Afterwards, running sam --version, I get this:

The program 'sam' is currently not installed. You can install it by typing:
sudo apt install simon

You can follow the docs under “Install the AWS SAM CLI Using Linuxbrew” in the link I have above. This describes the step need to install.

https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory Looks like you are missing header files from the python language.