aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Error installing aws-sam-cli

Open IsraelGboluwaga opened this issue 7 years ago • 19 comments

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

IsraelGboluwaga avatar Jan 08 '19 15:01 IsraelGboluwaga

@IsraelGboluwaga What is the version of Python you are trying to install into?

jfuss avatar Jan 08 '19 15:01 jfuss

Python 3.5.2

IsraelGboluwaga avatar Jan 08 '19 15:01 IsraelGboluwaga

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.

jfuss avatar Jan 08 '19 15:01 jfuss

Thanks. I updated my python version and I've progressed past that point. I've got another error.

Output:

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 pip
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 148kB/s 
Installing collected packages: pip
Successfully installed pip-18.1
israel@Israel:~/lambda/new-shit$ pip --version
pip 18.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
israel@Israel:~/lambda/new-shit$ pip install --user --upgrade aws-sam-cli
Collecting aws-sam-cli
  Using cached https://files.pythonhosted.org/packages/c3/7c/79463add5772a98f044fab3024c27db61550bb1d9bbd06a715e3c3dc6b2a/aws_sam_cli-0.10.0-py3-none-any.whl
Collecting boto3>=1.9.56,~=1.9 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/16/e7/71e849d9e7f4f0ba04b9182ca7eaa2e5a33e653a7335fa64cda96f9832fb/boto3-1.9.75-py2.py3-none-any.whl
Collecting six~=1.11.0 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting requests==2.20.1 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/ff/17/5cbb026005115301a8fb2f9b0e3e8d32313142fe8b617070e7baad20554f/requests-2.20.1-py2.py3-none-any.whl
Collecting PyYAML~=3.12 (from aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz (270kB)
    100% |████████████████████████████████| 276kB 286kB/s 
Collecting serverlessrepo==0.1.5 (from aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/78/15/3ffa02ff48b06a784f8cb1aa0a0ae7d1d8b826356b567045b7a302f1cc34/serverlessrepo-0.1.5-py2.py3-none-any.whl
Collecting python-dateutil~=2.6 (from aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/74/68/d87d9b36af36f44254a8d512cbfc48369103a3b9e474be9bdfe536abfc45/python_dateutil-2.7.5-py2.py3-none-any.whl (225kB)
    100% |████████████████████████████████| 235kB 389kB/s 
Collecting aws-lambda-builders==0.0.5 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/3e/fa/9d0cdb3557850d9745afeb1d8fd874c05871db9b23c35597b19cbeb93d19/aws_lambda_builders-0.0.5-py3-none-any.whl
Collecting chevron~=0.12 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/a3/1e/6ef58385f54c5bbf70b3b451930015aa2d30b3cd5ae324bba4da77c5b889/chevron-0.13.1-py3-none-any.whl
Collecting Flask~=1.0.2 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl
Collecting click~=6.7 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Collecting docker>=3.3.0 (from aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/e1/58/938fbc7acd98302ca4872f5eab8ab811498e342ab5aec0c1609f22e0aeda/docker-3.6.0-py2.py3-none-any.whl (131kB)
    100% |████████████████████████████████| 133kB 145kB/s 
Collecting aws-sam-translator==1.9.0 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/48/2a/e74d86153faaafb96a7ee81d8dca66f7aeecf319a7217db30ec9cac88ddf/aws-sam-translator-1.9.0.tar.gz
  Ignoring enum34: markers 'python_version < "3.4"' don't match your environment
Collecting cookiecutter~=1.6.0 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/16/99/1ca3a75978270288354f419e9166666801cf7e7d8df984de44a7d5d8b8d0/cookiecutter-1.6.0-py2.py3-none-any.whl
Collecting dateparser~=0.7 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/ac/9e/1aa87c0c59f9731820bfd20a8b148d97b315530c2c92d1fb300328c8c42f/dateparser-0.7.0-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: jmespath<1.0.0,>=0.7.1 in /usr/lib/python3/dist-packages (from boto3>=1.9.56,~=1.9->aws-sam-cli) (0.9.0)
Collecting botocore<1.13.0,>=1.12.75 (from boto3>=1.9.56,~=1.9->aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/13/33/255ded426fa6f79767cea0bbd1a7ae6231ee52cbb827612449fc97cb37a2/botocore-1.12.75-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.10 (from boto3>=1.9.56,~=1.9->aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/d7/14/2a0004d487464d120c9fb85313a75cd3d71a7506955be458eebfe19a6b1d/s3transfer-0.1.13-py2.py3-none-any.whl
Collecting idna<2.8,>=2.5 (from requests==2.20.1->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
    100% |████████████████████████████████| 61kB 239kB/s 
Collecting urllib3<1.25,>=1.21.1 (from requests==2.20.1->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl (118kB)
    100% |████████████████████████████████| 122kB 372kB/s 
Collecting certifi>=2017.4.17 (from requests==2.20.1->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/9f/e0/accfc1b56b57e9750eba272e24c4dddeac86852c2bebd1236674d7887e8a/certifi-2018.11.29-py2.py3-none-any.whl (154kB)
    100% |████████████████████████████████| 163kB 306kB/s 
Collecting chardet<3.1.0,>=3.0.2 (from requests==2.20.1->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 318kB/s 
Requirement already satisfied, skipping upgrade: wheel in /usr/lib/python3/dist-packages (from aws-lambda-builders==0.0.5->aws-sam-cli) (0.29.0)
Requirement already satisfied, skipping upgrade: setuptools in /usr/lib/python3/dist-packages (from aws-lambda-builders==0.0.5->aws-sam-cli) (20.7.0)
Collecting itsdangerous>=0.24 (from Flask~=1.0.2->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Werkzeug>=0.14 (from Flask~=1.0.2->aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from Flask~=1.0.2->aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl
Collecting docker-pycreds>=0.3.0 (from docker>=3.3.0->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/f5/e8/f6bd1eee09314e7e6dee49cbe2c5e22314ccdb38db16c9fc72d2fa80d054/docker_pycreds-0.4.0-py2.py3-none-any.whl
Collecting websocket-client>=0.32.0 (from docker>=3.3.0->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/26/2d/f749a5c82f6192d77ed061a38e02001afcba55fe8477336d26a950ab17ce/websocket_client-0.54.0-py2.py3-none-any.whl (200kB)
    100% |████████████████████████████████| 204kB 285kB/s 
Collecting jsonschema~=2.6 (from aws-sam-translator==1.9.0->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl
Collecting binaryornot>=0.2.0 (from cookiecutter~=1.6.0->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/24/7e/f7b6f453e6481d1e233540262ccbfcf89adcd43606f44a028d7f5fae5eb2/binaryornot-0.4.4-py2.py3-none-any.whl
Collecting future>=0.15.2 (from cookiecutter~=1.6.0->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/90/52/e20466b85000a181e1e144fd8305caf2cf475e2f9674e797b222f8105f5f/future-0.17.1.tar.gz (829kB)
    100% |████████████████████████████████| 829kB 276kB/s 
Collecting whichcraft>=0.4.0 (from cookiecutter~=1.6.0->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/ab/c6/eb4d1dfbb68168bb01c4394420e5e71d5851e64b910838aa0f14ebd5c7a0/whichcraft-0.5.2-py2.py3-none-any.whl
Collecting jinja2-time>=0.1.0 (from cookiecutter~=1.6.0->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/6a/a1/d44fa38306ffa34a7e1af09632b158e13ec89670ce491f8a15af3ebcb4e4/jinja2_time-0.2.0-py2.py3-none-any.whl
Collecting poyo>=0.1.0 (from cookiecutter~=1.6.0->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/e0/16/e00e3001007a5e416ca6a51def6f9e4be6a774bf1c8486d20466f834d113/poyo-0.4.2-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: pytz in /usr/lib/python3/dist-packages (from dateparser~=0.7->aws-sam-cli) (2014.10)
Collecting tzlocal (from dateparser~=0.7->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/cb/89/e3687d3ed99bc882793f82634e9824e62499fdfdc4b1ae39e211c5b05017/tzlocal-1.5.1.tar.gz
Collecting regex (from dateparser~=0.7->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/16/07/ee3e02770ed456a088b90da7c9b1e9aa227e3c956d37b845cef2aab93764/regex-2018.11.22.tar.gz (648kB)
    100% |████████████████████████████████| 655kB 172kB/s 
Requirement already satisfied, skipping upgrade: docutils>=0.10 in /usr/lib/python3/dist-packages (from botocore<1.13.0,>=1.12.75->boto3>=1.9.56,~=1.9->aws-sam-cli) (0.12)
Requirement already satisfied, skipping upgrade: MarkupSafe>=0.23 in /usr/lib/python3/dist-packages (from Jinja2>=2.10->Flask~=1.0.2->aws-sam-cli) (0.23)
Collecting arrow (from jinja2-time>=0.1.0->cookiecutter~=1.6.0->aws-sam-cli)
  Downloading https://files.pythonhosted.org/packages/5d/c7/468bb95a10fb8ddb5f3f80e1aef06b78f64d6e5df958c39672f80581381f/arrow-0.13.0.tar.gz (92kB)
    100% |████████████████████████████████| 102kB 281kB/s 
Building wheels for collected packages: PyYAML, aws-sam-translator, future, tzlocal, regex, arrow
  Running setup.py bdist_wheel for PyYAML ... done
  Stored in directory: /home/israel/.cache/pip/wheels/ad/da/0c/74eb680767247273e2cf2723482cb9c924fe70af57c334513f
  Running setup.py bdist_wheel for aws-sam-translator ... done
  Stored in directory: /home/israel/.cache/pip/wheels/94/1a/4c/c9c684c274d1275951aced3e6a113e706941a9c2f6ee317e55
  Running setup.py bdist_wheel for future ... done
  Stored in directory: /home/israel/.cache/pip/wheels/0c/61/d2/d6b7317325828fbb39ee6ad559dbe4664d0896da4721bf379e
  Running setup.py bdist_wheel for tzlocal ... done
  Stored in directory: /home/israel/.cache/pip/wheels/15/ae/df/a67bf1ed84e9bf230187d36d8dcfd30072bea0236cb059ed91
  Running setup.py bdist_wheel for regex ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-rohghlsd/regex/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-ufa6x7v1 --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  copying regex_3/regex.py -> build/lib.linux-x86_64-3.6
  copying regex_3/_regex_core.py -> build/lib.linux-x86_64-3.6
  copying regex_3/test_regex.py -> build/lib.linux-x86_64-3.6
  running build_ext
  building '_regex' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/regex_3
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c regex_3/_regex.c -o build/temp.linux-x86_64-3.6/regex_3/_regex.o
  regex_3/_regex.c:46:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for regex
  Running setup.py clean for regex
  Running setup.py bdist_wheel for arrow ... done
  Stored in directory: /home/israel/.cache/pip/wheels/1e/d5/30/cace6155de216c74f70b1b866ce6ec2c9bbc60be88073a1fcd
Successfully built PyYAML aws-sam-translator future tzlocal arrow
Failed to build regex
aws-sam-translator 1.9.0 requires enum34~=1.1, which is not installed.
Installing collected packages: six, python-dateutil, urllib3, botocore, s3transfer, boto3, idna, certifi, chardet, requests, PyYAML, serverlessrepo, aws-lambda-builders, chevron, click, itsdangerous, Werkzeug, Jinja2, Flask, docker-pycreds, websocket-client, docker, jsonschema, aws-sam-translator, binaryornot, future, whichcraft, arrow, jinja2-time, poyo, cookiecutter, tzlocal, regex, dateparser, aws-sam-cli
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/home/israel/.local/bin/jsonschema'
Check the permissions.

IsraelGboluwaga avatar Jan 08 '19 16:01 IsraelGboluwaga

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.

jfuss avatar Jan 08 '19 16:01 jfuss

Thanks @jfuss

I have this now:

Collecting aws-sam-cli
  Using cached https://files.pythonhosted.org/packages/c3/7c/79463add5772a98f044fab3024c27db61550bb1d9bbd06a715e3c3dc6b2a/aws_sam_cli-0.10.0-py3-none-any.whl
Requirement already satisfied, skipping upgrade: boto3>=1.9.56,~=1.9 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (1.9.75)
Requirement already satisfied, skipping upgrade: python-dateutil~=2.6 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (2.7.5)
Requirement already satisfied, skipping upgrade: aws-lambda-builders==0.0.5 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (0.0.5)
Collecting dateparser~=0.7 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/ac/9e/1aa87c0c59f9731820bfd20a8b148d97b315530c2c92d1fb300328c8c42f/dateparser-0.7.0-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: serverlessrepo==0.1.5 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (0.1.5)
Requirement already satisfied, skipping upgrade: docker>=3.3.0 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (3.6.0)
Requirement already satisfied, skipping upgrade: six~=1.11.0 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (1.11.0)
Collecting cookiecutter~=1.6.0 (from aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/16/99/1ca3a75978270288354f419e9166666801cf7e7d8df984de44a7d5d8b8d0/cookiecutter-1.6.0-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: requests==2.20.1 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (2.20.1)
Requirement already satisfied, skipping upgrade: chevron~=0.12 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (0.13.1)
Requirement already satisfied, skipping upgrade: click~=6.7 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (6.7)
Requirement already satisfied, skipping upgrade: PyYAML~=3.12 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (3.13)
Collecting aws-sam-translator==1.9.0 (from aws-sam-cli)
Requirement already satisfied, skipping upgrade: Flask~=1.0.2 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-cli) (1.0.2)
Requirement already satisfied, skipping upgrade: botocore<1.13.0,>=1.12.75 in /home/israel/.local/lib/python3.6/site-packages (from boto3>=1.9.56,~=1.9->aws-sam-cli) (1.12.75)
Requirement already satisfied, skipping upgrade: s3transfer<0.2.0,>=0.1.10 in /home/israel/.local/lib/python3.6/site-packages (from boto3>=1.9.56,~=1.9->aws-sam-cli) (0.1.13)
Requirement already satisfied, skipping upgrade: jmespath<1.0.0,>=0.7.1 in /usr/lib/python3/dist-packages (from boto3>=1.9.56,~=1.9->aws-sam-cli) (0.9.0)
Requirement already satisfied, skipping upgrade: setuptools in /usr/lib/python3/dist-packages (from aws-lambda-builders==0.0.5->aws-sam-cli) (20.7.0)
Requirement already satisfied, skipping upgrade: wheel in /usr/lib/python3/dist-packages (from aws-lambda-builders==0.0.5->aws-sam-cli) (0.29.0)
Requirement already satisfied, skipping upgrade: pytz in /usr/lib/python3/dist-packages (from dateparser~=0.7->aws-sam-cli) (2014.10)
Collecting tzlocal (from dateparser~=0.7->aws-sam-cli)
Collecting regex (from dateparser~=0.7->aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/16/07/ee3e02770ed456a088b90da7c9b1e9aa227e3c956d37b845cef2aab93764/regex-2018.11.22.tar.gz
Requirement already satisfied, skipping upgrade: docker-pycreds>=0.3.0 in /home/israel/.local/lib/python3.6/site-packages (from docker>=3.3.0->aws-sam-cli) (0.4.0)
Requirement already satisfied, skipping upgrade: websocket-client>=0.32.0 in /home/israel/.local/lib/python3.6/site-packages (from docker>=3.3.0->aws-sam-cli) (0.54.0)
Collecting binaryornot>=0.2.0 (from cookiecutter~=1.6.0->aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/24/7e/f7b6f453e6481d1e233540262ccbfcf89adcd43606f44a028d7f5fae5eb2/binaryornot-0.4.4-py2.py3-none-any.whl
Collecting jinja2-time>=0.1.0 (from cookiecutter~=1.6.0->aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/6a/a1/d44fa38306ffa34a7e1af09632b158e13ec89670ce491f8a15af3ebcb4e4/jinja2_time-0.2.0-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: jinja2>=2.7 in /home/israel/.local/lib/python3.6/site-packages (from cookiecutter~=1.6.0->aws-sam-cli) (2.10)
Collecting whichcraft>=0.4.0 (from cookiecutter~=1.6.0->aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/ab/c6/eb4d1dfbb68168bb01c4394420e5e71d5851e64b910838aa0f14ebd5c7a0/whichcraft-0.5.2-py2.py3-none-any.whl
Collecting poyo>=0.1.0 (from cookiecutter~=1.6.0->aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/e0/16/e00e3001007a5e416ca6a51def6f9e4be6a774bf1c8486d20466f834d113/poyo-0.4.2-py2.py3-none-any.whl
Collecting future>=0.15.2 (from cookiecutter~=1.6.0->aws-sam-cli)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /home/israel/.local/lib/python3.6/site-packages (from requests==2.20.1->aws-sam-cli) (2018.11.29)
Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.21.1 in /home/israel/.local/lib/python3.6/site-packages (from requests==2.20.1->aws-sam-cli) (1.24.1)
Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in /home/israel/.local/lib/python3.6/site-packages (from requests==2.20.1->aws-sam-cli) (3.0.4)
Requirement already satisfied, skipping upgrade: idna<2.8,>=2.5 in /home/israel/.local/lib/python3.6/site-packages (from requests==2.20.1->aws-sam-cli) (2.7)
Requirement already satisfied, skipping upgrade: jsonschema~=2.6 in /home/israel/.local/lib/python3.6/site-packages (from aws-sam-translator==1.9.0->aws-sam-cli) (2.6.0)
Collecting enum34~=1.1 (from aws-sam-translator==1.9.0->aws-sam-cli)
  Using cached https://files.pythonhosted.org/packages/af/42/cb9355df32c69b553e72a2e28daee25d1611d2c0d9c272aa1d34204205b2/enum34-1.1.6-py3-none-any.whl
Requirement already satisfied, skipping upgrade: Werkzeug>=0.14 in /home/israel/.local/lib/python3.6/site-packages (from Flask~=1.0.2->aws-sam-cli) (0.14.1)
Requirement already satisfied, skipping upgrade: itsdangerous>=0.24 in /home/israel/.local/lib/python3.6/site-packages (from Flask~=1.0.2->aws-sam-cli) (1.1.0)
Requirement already satisfied, skipping upgrade: docutils>=0.10 in /usr/lib/python3/dist-packages (from botocore<1.13.0,>=1.12.75->boto3>=1.9.56,~=1.9->aws-sam-cli) (0.12)
Collecting arrow (from jinja2-time>=0.1.0->cookiecutter~=1.6.0->aws-sam-cli)
Requirement already satisfied, skipping upgrade: MarkupSafe>=0.23 in /usr/lib/python3/dist-packages (from jinja2>=2.7->cookiecutter~=1.6.0->aws-sam-cli) (0.23)
Building wheels for collected packages: regex
  Running setup.py bdist_wheel for regex ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-obd5rx2_/regex/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-esowcqhr --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  copying regex_3/regex.py -> build/lib.linux-x86_64-3.6
  copying regex_3/_regex_core.py -> build/lib.linux-x86_64-3.6
  copying regex_3/test_regex.py -> build/lib.linux-x86_64-3.6
  running build_ext
  building '_regex' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/regex_3
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c regex_3/_regex.c -o build/temp.linux-x86_64-3.6/regex_3/_regex.o
  regex_3/_regex.c:46:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for regex
  Running setup.py clean for regex
Failed to build regex
Installing collected packages: tzlocal, regex, dateparser, binaryornot, arrow, jinja2-time, whichcraft, poyo, future, cookiecutter, enum34, aws-sam-translator, aws-sam-cli
  Running setup.py install for regex ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-obd5rx2_/regex/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-vpv7qosg/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    copying regex_3/regex.py -> build/lib.linux-x86_64-3.6
    copying regex_3/_regex_core.py -> build/lib.linux-x86_64-3.6
    copying regex_3/test_regex.py -> build/lib.linux-x86_64-3.6
    running build_ext
    building '_regex' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/regex_3
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c regex_3/_regex.c -o build/temp.linux-x86_64-3.6/regex_3/_regex.o
    regex_3/_regex.c:46:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-obd5rx2_/regex/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-vpv7qosg/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-obd5rx2_/regex/```

IsraelGboluwaga avatar Jan 08 '19 16:01 IsraelGboluwaga

Is there any reason you don't just want to use LinuxBrew to install? All this should be avoidable if you just use the installers instead of pip. Using pip will have these pitfalls where our installation is completely dependent on how you install python (among other things), which is something outside of installing our CLI.

jfuss avatar Jan 08 '19 16:01 jfuss

I'm simply following the steps from https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html

I'll take a look at using LinuxBrew and give you feedback.

IsraelGboluwaga avatar Jan 08 '19 16:01 IsraelGboluwaga

The Linux specific guide has details on LinuxBrew: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-linux.html. We are working on removing the pip details to customers can get started on the right foot and hopefully avoid some of the pain points you have run into.

jfuss avatar Jan 08 '19 16:01 jfuss

Do I simply do brew install aws-sam-cli ??

IsraelGboluwaga avatar Jan 08 '19 16:01 IsraelGboluwaga

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.

jfuss avatar Jan 08 '19 16:01 jfuss

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

IsraelGboluwaga avatar Jan 09 '19 11:01 IsraelGboluwaga

Thank you @jfuss for all the help. It's successfully installed now. I should have used a virtual environment all along.

IsraelGboluwaga avatar Jan 09 '19 13:01 IsraelGboluwaga

Thank you @jfuss for all the help. It's successfully installed now. I should have used a virtual environment all along.

@IsraelGboluwaga I'm facing a same problem, what do you mean by "virtual environment"?

yort-feng avatar Feb 28 '19 02:02 yort-feng

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

kyuridenamida avatar Mar 10 '19 14:03 kyuridenamida

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

I'd tried it, but it didn't work for me, thank you anyway!

yort-feng avatar Mar 11 '19 03:03 yort-feng

ild_ext building '_regex' extension creating build/temp.linux-x86_64-3.6 creating build/temp.linux-x86_64-3.6/regex_3 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c regex_3/_regex.c -o build/temp.linux-x86_64-3.6/regex_3/_regex.o regex_3/_regex.c:46:20: fatal error: Python.h: No such file or directory compilation termina

https://github.com/awslabs/aws-sam-cli/issues/922#issuecomment-452366133

It seems that you have already solved in other ways. Just for anyone who wants to solve the problem above, Please try again after installing python dev package. That works for me, I'm using python3.6, pip3.6

$ sudo apt-get install python3.6-dev $ sudo pip3.6 install aws-sam-cli

For the problem installing aws-sam-cli with pip3.6

Scottbae37 avatar Apr 26 '19 04:04 Scottbae37

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

This worked for me as well. Thanks

yashdattsawant avatar Apr 20 '20 11:04 yashdattsawant

Not sure if this is the right way to reopen this issue. I followed the Installing the AWS SAM CLI on Linux steps with Homebrew for Linux (Ubuntu 20), but after a successfull installation, I got a command not found error when tried: sam --version

So I did brew uninstall aws-sam-cli, and then tried:

git clone https://github.com/awslabs/aws-sam-cli.git
cd aws-sam-cli
sudo python3 ./setup.py build install

I have this Python:

$ python3 --version
Python 3.8.5

Everything seemed well until I got this:

Installed /usr/local/lib/python3.8/dist-packages/aws_sam_cli-1.15.0-py3.8.egg
Processing dependencies for aws-sam-cli==1.15.0
error: six 1.14.0 is installed but six~=1.15 is required by {'aws-sam-translator'}

(first two lines for context)

Then I tried this:

$ sam --version
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 792, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.14.0 (/usr/lib/python3/dist-packages), Requirement.parse('six~=1.15'), {'aws-sam-translator'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/sam", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3254, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 586, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 599, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 792, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.14.0 (/usr/lib/python3/dist-packages), Requirement.parse('six~=1.15'), {'aws-sam-translator'})

Could you please support me with this issue? I'm trying to set up my environment properly, in order to run locally a lambda function written in TypeScript over Node.js

Thanks in advance!

pequetreques avatar Jan 29 '21 06:01 pequetreques