Description:
I got an error when trying to install the new version on MacOS
Steps to reproduce the issue:
npm uninstall -g aws-sam-localObserved result:
removed 66 packages in 1.135ssam --version : -bash: sam: command not foundpip install --user --upgrade aws-sam-cliwith or without sudo :Collecting aws-sam-cli
Using cached https://files.pythonhosted.org/packages/bd/48/6b916e5df626c19502207a8553c174d585e641a0e93d5f11f08e6e205091/aws-sam-cli-0.4.0.tar.gz
Complete output from command python setup.py egg_info:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
error in aws-sam-cli setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.Expected result:
New version installed
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
ProductName: Mac OS X
ProductVersion: 10.13.5
BuildVersion: 17F77
Output of sam --version:
-bash: sam: command not found
Optional Debug logs:
Add --debug flag to command you are running
Did you try $ pip install --user aws-sam-cli instead of upgrade
Try
pip install --upgrade setuptools
pip install ez_setup
pip install --user --upgrade aws-sam-cli
@terrywarwar yes I tried it : no change
@Maxmus1989 may be there is something with setup tools, here is the output
pip install --upgrade setuptools
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/7f/e1/820d941153923aac1d49d7fc37e17b6e73bfbd2904959fffbad77900cf92/setuptools-39.2.0-py2.py3-none-any.whl (567kB)
100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 573kB 6.2MB/s
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: setuptools
Found existing installation: setuptools 18.5
Uninstalling setuptools-18.5:
Could not install packages due to an EnvironmentError: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/private/var/folders/bj/jl6ztftj0ks5rdpw5yh_cdbr0000gn/T/pip-uninstall-4blVR1/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/private/var/folders/bj/jl6ztftj0ks5rdpw5yh_cdbr0000gn/T/pip-uninstall-4blVR1/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/private/var/folders/bj/jl6ztftj0ks5rdpw5yh_cdbr0000gn/T/pip-uninstall-4blVR1/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/private/var/folders/bj/jl6ztftj0ks5rdpw5yh_cdbr0000gn/T/pip-uninstall-4blVR1/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/private/var/folders/bj/jl6ztftj0ks5rdpw5yh_cdbr0000gn/T/pip-uninstall-4blVR1/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/private/var/folders/bj/jl6ztftj0ks5rdpw5yh_cdbr0000gn/T/pip-uninstall-4blVR1/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/private/var/folders/bj/jl6ztftj0ks5rdpw5yh_cdbr0000gn/T/pip-uninstall-4blVR1/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/private/var/folders/bj/jl6ztftj0ks5rdpw5yh_cdbr0000gn/T/pip-uninstall-4blVR1/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/private/var/folders/bj/jl6ztftj0ks5rdpw5yh_cdbr0000gn/T/pip-uninstall-4blVR1/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/private/var/folders/bj/jl6ztftj0ks5rdpw5yh_cdbr0000gn/T/pip-uninstall-4blVR1/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]
Try with --user flag?
pip install --user --upgrade setuptools
Nice @Maxmus1989 you saved my life
May be it can be useful for those, like me, that are not familiar with py and pip, to add this in the installation instructions.
Because I did not understand at all what I did with the command pip install --user --upgrade setuptools and pip install ez_setup
Hi,
Same issue here. Thansk @Maxmus1989 for the solution.
+1 for a doc improvement. pip is utterly bewildering to non-python devs
Cheers
Adrian
In case anyone finds this useful. I was able to solve this issue by creating a virtual environment with the 'virtualenv' command and setting it to use python 3.6 as its Python (--python flag).
Once the virtual environment was created, activate it and then within just ran pip install aws-sam-cli.
No issues at all after that.
One small caveat which is something I can live with (until the normal installation process becomes more robust and easier) is that when executing the sam command, you need to provide the full path to the "sam" executable which is under the virtual environment's "bin" directory.
@piersf If you add the path to the cli in your PATH, you will not need to provide the full path to the executable.
@jfuss yep, of course. That's what I ended up doing after posting the comment here.
Thanks for replying.
Thanks @Maxmus1989 for this pip install --user --upgrade setuptools my BP is low now :)
Thanks @Maxmus1989
The information about setuptools upgrade should definitely be mentioned in the official Readme file. Steps which are mentioned right now are not enough to succeed, as we see most of the times.
Try this. Works for me.
pip install --user --upgrade setuptools
pip install --user ez_setup
pip install --user --upgrade aws-sam-cli
@benweizhu & @Maxmus1989:
Thanks for sharing this:
I can confirm this works on Mac running Python 2.7.
It gets you to 0.5.0 of sam.
To run the sam command I needed to add ~/Library/Python/2.7/bin to my PATH.
I'm trying to install on MacOSX Mojave (10.14.1)
`$ pip install --user --upgrade setuptools
Collecting setuptools
Using cached https://files.pythonhosted.org/packages/e7/16/da8cb8046149d50940c6110310983abb359bbb8cbc3539e6bef95c29428a/setuptools-40.6.2-py2.py3-none-any.whl
Installing collected packages: setuptools
Successfully installed setuptools-40.6.2
$
$ pip install --user ez_setup
Collecting ez_setup
Downloading https://files.pythonhosted.org/packages/ba/2c/743df41bd6b3298706dfe91b0c7ecdc47f2dc1a3104abeb6e9aa4a45fa5d/ez_setup-0.9.tar.gz
Building wheels for collected packages: ez-setup
Running setup.py bdist_wheel for ez-setup ... done
Stored in directory: /Users/myname/Library/Caches/pip/wheels/dc/e8/6b/3d5ff5a3efd7b5338d1e173ac981771e2628ceb2f7866d49ad
Successfully built ez-setup
Installing collected packages: ez-setup
Successfully installed ez-setup-0.9
$
$ pip install --user --upgrade aws-sam-cli
Collecting aws-sam-cli
Using cached https://files.pythonhosted.org/packages/7c/02/dcc93998304209559df7f6acc6ff09a3620805847b56f41b0a1fac39c8e2/aws_sam_cli-0.7.0-py2-none-any.whl
Collecting aws-lambda-builders==0.0.2 (from aws-sam-cli)
Using cached https://files.pythonhosted.org/packages/52/5b/2aebd31a0a25a6e31f172016c7164a205bb68dc53e7f4d5766ce76b41154/aws_lambda_builders-0.0.2.tar.gz
Complete output from command python setup.py egg_info:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
error in aws_lambda_builders setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/4g/_c59vhkn7pn2fqprb0h3dsyw0000gn/T/pip-install-jtoVpl/aws-lambda-builders/
$
$ pip install --user aws-sam-cli
Collecting aws-sam-cli
Using cached https://files.pythonhosted.org/packages/7c/02/dcc93998304209559df7f6acc6ff09a3620805847b56f41b0a1fac39c8e2/aws_sam_cli-0.7.0-py2-none-any.whl
Collecting aws-lambda-builders==0.0.2 (from aws-sam-cli)
Using cached https://files.pythonhosted.org/packages/52/5b/2aebd31a0a25a6e31f172016c7164a205bb68dc53e7f4d5766ce76b41154/aws_lambda_builders-0.0.2.tar.gz
Complete output from command python setup.py egg_info:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
error in aws_lambda_builders setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/4g/_c59vhkn7pn2fqprb0h3dsyw0000gn/T/pip-install-qt8ORn/aws-lambda-builders/
$`
@slimandslam try the brew install option.
I'm on a brand new Mac Mini -- don't want to install homebrew. :-) And I shouldn't have to, right?
using homebrew is super simple.
Just follow this guide: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-mac.html
@slimandslam But your brand new Mac is still running Python that was released in 23 May 2015, not to mention is it Python2.7, which is eol Jan 1 2020.
You don't have to use brew but then you must manage the Python version and make sure it is up to date with what we are using (why you have to upgrade a bunch of packages). On top of that, installing in your system's python runs the risk of you messing up your system. If you upgrade the a package that is not compatible with something else installed other programs will not work that your os may need. Even if you download and install a different Python and install all 3rd party packages there, you still run the risk of dependencies clashing (which we have run into with aws cli or other customers using flask).
We may expand installations in the future but we made a choice to support homebrew for Mac, as majority of Mac users install it for package management. For now, the recommendation is to use Homebrew on Mac (following the instructions @TheSriram linked above). If you choose to use pip (highly not recommended), you must keep the tools installed and run the risk of dependency clashing with other tools or libraries you want to use.
Closing this issue as the installers released in 0.6.2 are the preferred way to install and solve the initially issue.
I'm just following the official (?) installation directions. If you want to actually HELP developers, then change the official (?) documentation:
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html
Yes we are aware that needs an update and are trying to make that happen.
As an aside, we have a landing page: https://aws.amazon.com/serverless/sam/ that has the different options (pip being the last box).
Iam glad I stumbled on this after spending 30 mins on debugging issues with installing SAM in Mac. Here is what worked for me. Wish this documentation is updated - https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-additional.html
pip install --user --upgrade setuptools
pip install --user ez_setup
pip install --user --upgrade aws-sam-cli
# Add below to .bash profile
USER_BASE_PATH=$(python -m site --user-base)
export PATH=$PATH:$USER_BASE_PATH/bin
Most helpful comment
Try with
--userflag?