aws-sam-cli: Error when installing python version on MACOS

Description:

I got an error when trying to install the new version on MacOS

Steps to reproduce the issue:

  1. uninstall old version with npm : npm uninstall -g aws-sam-local
  2. verify that sam is uninstalled
  3. Try to install with pip

Observed result:

  1. uninstall old version with npm ok : removed 66 packages in 1.135s
  2. sam --version : -bash: sam: command not found
  3. pip 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

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (4 by maintainers)

Most upvoted comments

Try with --user flag?

pip install --user --upgrade setuptools

Try

pip install --upgrade setuptools
pip install ez_setup
pip install --user --upgrade aws-sam-cli

Try this. Works for me.

pip install --user --upgrade setuptools
pip install --user ez_setup
pip install --user --upgrade aws-sam-cli

Hi,

Same issue here. Thansk @Maxmus1989 for the solution.

+1 for a doc improvement. pip is utterly bewildering to non-python devs

Cheers

Adrian

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/ $`

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

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.