Following the instructions I got this feedback.
[duffy@mbp ~]$ npm uninstall -g aws-sam-local
up to date in 0.041s
[duffy@mbp ~]$ pip --version
pip 10.0.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
[duffy@mbp ~]$ sam --version
-bash: sam: command not found
[duffy@mbp ~]$ pip install --user aws-sam-cli
Requirement already satisfied: aws-sam-cli in ./Library/Python/2.7/lib/python/site-packages (0.3.0)
Requirement already satisfied: enum34~=1.1.6 in /usr/local/lib/python2.7/site-packages (from aws-sam-cli) (1.1.6)
Requirement already satisfied: aws-sam-translator==1.5.4 in ./Library/Python/2.7/lib/python/site-packages (from aws-sam-cli) (1.5.4)
Requirement already satisfied: click~=6.7 in ./Library/Python/2.7/lib/python/site-packages (from aws-sam-cli) (6.7)
Requirement already satisfied: PyYAML~=3.12 in ./Library/Python/2.7/lib/python/site-packages (from aws-sam-cli) (3.12)
Requirement already satisfied: Flask~=0.12.2 in ./Library/Python/2.7/lib/python/site-packages (from aws-sam-cli) (0.12.4)
Requirement already satisfied: docker>=3.3.0 in ./Library/Python/2.7/lib/python/site-packages (from aws-sam-cli) (3.3.0)
Requirement already satisfied: boto3~=1.5 in ./Library/Python/2.7/lib/python/site-packages (from aws-sam-cli) (1.7.16)
Requirement already satisfied: six~=1.11.0 in /usr/local/lib/python2.7/site-packages (from aws-sam-cli) (1.11.0)
Requirement already satisfied: cookiecutter~=1.6.0 in ./Library/Python/2.7/lib/python/site-packages (from aws-sam-cli) (1.6.0)
Requirement already satisfied: jsonschema~=2.6 in ./Library/Python/2.7/lib/python/site-packages (from aws-sam-translator==1.5.4->aws-sam-cli) (2.6.0)
Requirement already satisfied: Jinja2>=2.4 in ./Library/Python/2.7/lib/python/site-packages (from Flask~=0.12.2->aws-sam-cli) (2.10)
Requirement already satisfied: Werkzeug>=0.7 in ./Library/Python/2.7/lib/python/site-packages (from Flask~=0.12.2->aws-sam-cli) (0.14.1)
Requirement already satisfied: itsdangerous>=0.21 in ./Library/Python/2.7/lib/python/site-packages (from Flask~=0.12.2->aws-sam-cli) (0.24)
Requirement already satisfied: backports.ssl-match-hostname>=3.5; python_version < "3.5" in ./Library/Python/2.7/lib/python/site-packages (from docker>=3.3.0->aws-sam-cli) (3.5.0.1)
Requirement already satisfied: ipaddress>=1.0.16; python_version < "3.3" in ./Library/Python/2.7/lib/python/site-packages (from docker>=3.3.0->aws-sam-cli) (1.0.22)
Requirement already satisfied: requests!=2.18.0,>=2.14.2 in ./Library/Python/2.7/lib/python/site-packages (from docker>=3.3.0->aws-sam-cli) (2.18.4)
Requirement already satisfied: docker-pycreds>=0.2.3 in ./Library/Python/2.7/lib/python/site-packages (from docker>=3.3.0->aws-sam-cli) (0.2.3)
Requirement already satisfied: websocket-client>=0.32.0 in ./Library/Python/2.7/lib/python/site-packages (from docker>=3.3.0->aws-sam-cli) (0.47.0)
Requirement already satisfied: botocore<1.11.0,>=1.10.16 in ./Library/Python/2.7/lib/python/site-packages (from boto3~=1.5->aws-sam-cli) (1.10.16)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in ./Library/Python/2.7/lib/python/site-packages (from boto3~=1.5->aws-sam-cli) (0.1.13)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in ./Library/Python/2.7/lib/python/site-packages (from boto3~=1.5->aws-sam-cli) (0.9.3)
Requirement already satisfied: binaryornot>=0.2.0 in ./Library/Python/2.7/lib/python/site-packages (from cookiecutter~=1.6.0->aws-sam-cli) (0.4.4)
Requirement already satisfied: jinja2-time>=0.1.0 in ./Library/Python/2.7/lib/python/site-packages (from cookiecutter~=1.6.0->aws-sam-cli) (0.2.0)
Requirement already satisfied: poyo>=0.1.0 in ./Library/Python/2.7/lib/python/site-packages (from cookiecutter~=1.6.0->aws-sam-cli) (0.4.1)
Requirement already satisfied: future>=0.15.2 in ./Library/Python/2.7/lib/python/site-packages (from cookiecutter~=1.6.0->aws-sam-cli) (0.16.0)
Requirement already satisfied: whichcraft>=0.4.0 in ./Library/Python/2.7/lib/python/site-packages (from cookiecutter~=1.6.0->aws-sam-cli) (0.4.1)
Requirement already satisfied: functools32; python_version == "2.7" in ./Library/Python/2.7/lib/python/site-packages (from jsonschema~=2.6->aws-sam-translator==1.5.4->aws-sam-cli) (3.2.3.post2)
Requirement already satisfied: MarkupSafe>=0.23 in ./Library/Python/2.7/lib/python/site-packages (from Jinja2>=2.4->Flask~=0.12.2->aws-sam-cli) (1.0)
Requirement already satisfied: certifi>=2017.4.17 in ./Library/Python/2.7/lib/python/site-packages (from requests!=2.18.0,>=2.14.2->docker>=3.3.0->aws-sam-cli) (2018.4.16)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./Library/Python/2.7/lib/python/site-packages (from requests!=2.18.0,>=2.14.2->docker>=3.3.0->aws-sam-cli) (3.0.4)
Requirement already satisfied: idna<2.7,>=2.5 in ./Library/Python/2.7/lib/python/site-packages (from requests!=2.18.0,>=2.14.2->docker>=3.3.0->aws-sam-cli) (2.6)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./Library/Python/2.7/lib/python/site-packages (from requests!=2.18.0,>=2.14.2->docker>=3.3.0->aws-sam-cli) (1.22)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1; python_version >= "2.7" in ./Library/Python/2.7/lib/python/site-packages (from botocore<1.11.0,>=1.10.16->boto3~=1.5->aws-sam-cli) (2.7.2)
Requirement already satisfied: docutils>=0.10 in ./Library/Python/2.7/lib/python/site-packages (from botocore<1.11.0,>=1.10.16->boto3~=1.5->aws-sam-cli) (0.14)
Requirement already satisfied: futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from s3transfer<0.2.0,>=0.1.10->boto3~=1.5->aws-sam-cli) (3.2.0)
Requirement already satisfied: arrow in ./Library/Python/2.7/lib/python/site-packages (from jinja2-time>=0.1.0->cookiecutter~=1.6.0->aws-sam-cli) (0.12.1)
Requirement already satisfied: backports.functools-lru-cache>=1.2.1; python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from arrow->jinja2-time>=0.1.0->cookiecutter~=1.6.0->aws-sam-cli) (1.5)
[duffy@mbp ~]$ sam --version
-bash: sam: command not found
@duffybelfield I have a PR out with additions to the README that cover this: https://github.com/awslabs/aws-sam-cli/pull/395
Make sure python -m site --user-base is in your $PATH.
Also ran to problem when upgrading using pip install --user aws-sam-cli with the following details:
OS: macOS Sierra 10.12.6
Python version (using pyenv): 2.7.6
Pip version: pip 10.0.1 from /Users/xxx/.pyenv/versions/2.7.6/lib/python2.7/site-packages/pip (python 2.7)
Stack trace:
```
clang -bundle -bundle_loader python.exe -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/Users/xxx/.pyenv/versions/2.7.6/lib build/temp.macosx-10.12-x86_64-2.7/ext/_yaml.o -lyaml -o build/lib.macosx-10.12-x86_64-2.7/_yaml.so
ld: file not found: python.exe
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Users/xxx/.pyenv/versions/2.7.6/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/lh/13z_298n2hl2ny0h6vqyjjhm0000gn/T/pip-install-Eiub_P/PyYAML/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/lh/13z_298n2hl2ny0h6vqyjjhm0000gn/T/pip-record-bvt8Hi/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /private/var/folders/lh/13z_298n2hl2ny0h6vqyjjhm0000gn/T/pip-install-Eiub_P/PyYAML/```
@livingmine Which platform are you on? I don't know why clang is trying to use python.exe. Can you also try without --user flag?
This is not related to SAM CLI installation but something else going wrong with your Python installation
@sanathkr macOS Sierra 10.12.6. Somewhere along the installation process lies this info
Failed building wheel for PyYAML
Running setup.py clean for PyYAML
Tried without --user but no luck. Possibly related to this https://github.com/pyenv/pyenv/issues/273, let me try their suggestions first.
This https://github.com/pyenv/pyenv/issues/273#issuecomment-312404367 fixes the problem. Thanks.
Sharing my solution to this issue.
While adding python packages path to your $PATH like @jfuss mentions above - I also had to add export /bin to my path - like this.
PATH=$USER_BASE_PATH/bin:$PATH
Link to PR #395.
Sharing my solution as well.
I had a version conflict. After installing localstack next to sam-local, sam-local would complain about a dependency called Flask.
Traceback (most recent call last):
File "c:\python36\lib\site-packages\pkg_resources\__init__.py", line 574, in _build_master
ws.require(__requires__)
File "c:\python36\lib\site-packages\pkg_resources\__init__.py", line 892, in require
needed = self.resolve(parse_requirements(requirements))
File "c:\python36\lib\site-packages\pkg_resources\__init__.py", line 783, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Flask 0.10.1 (c:\python36\lib\site-packages), Requirement.parse('Flask~=1.0.2'), {'aws-sam-cli'})
After updating pip with the following command, the version conflict had disappeared.
python -m pip install --upgrade pip
@nabels-coolblue That is not the case. Localstack has a requirement on Flask 0.10.1 and are pinning their versions. Localstack and SAM CLI most likely will not work together if install in the same location (due to how Python/PIP work and where they install).
Closing this issue.
Most helpful comment
Sharing my solution to this issue.
While adding python packages path to your
$PATHlike @jfuss mentions above - I also had to add export/binto my path - like this.PATH=$USER_BASE_PATH/bin:$PATHLink to PR #395.