aws / homebrew-tap

Homebrew formulae that allows installation of AWS tools through the Homebrew package manager.
Apache License 2.0
109 stars 96 forks source link

aws-sam-cli install fails. Error: Command '['/opt/homebrew/Cellar/aws-sam-cli/1.52.0/libexec/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1 #352

Open sebastian-nomi opened 2 years ago

sebastian-nomi commented 2 years ago

This is driving me crazy because I use AWS SAM 99% of the time at work. I had to uninstall/reinstall SAM and I get this error when I try to install it. Any help would be appreciated.

sebastian@Juans-MBP Downloads % brew tap aws/tap
brew install aws-sam-cli
==> Tapping aws/tap
Cloning into '/opt/homebrew/Library/Taps/aws/homebrew-tap'...
remote: Enumerating objects: 3618, done.
remote: Counting objects: 100% (1299/1299), done.
remote: Compressing objects: 100% (309/309), done.
remote: Total 3618 (delta 1169), reused 1042 (delta 990), pack-reused 2319
Receiving objects: 100% (3618/3618), 550.54 KiB | 2.70 MiB/s, done.
Resolving deltas: 100% (2642/2642), done.
Tapped 18 formulae (51 files, 713.7KB).
==> Downloading https://api.github.com/repos/aws/aws-sam-cli/tarball/v1.52.0
==> Downloading from https://codeload.github.com/aws/aws-sam-cli/legacy.tar.gz/refs/tags/v1.52.0
######################################################################## 100.0%
==> Installing aws-sam-cli from aws/tap
==> python3.8 -m venv --system-site-packages /opt/homebrew/Cellar/aws-sam-cli/1.52.0/libexec
Last 15 lines from /Users/sebastian/Library/Logs/Homebrew/aws-sam-cli/01.python3.8:
2022-06-15 22:45:31 +0000

python3.8
-m
venv
--system-site-packages
/opt/homebrew/Cellar/aws-sam-cli/1.52.0/libexec

Error: Command '['/opt/homebrew/Cellar/aws-sam-cli/1.52.0/libexec/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

Specs: MacOS Monterrey 12.4

sebastian@Juans-MBP Downloads % brew --version
Homebrew 3.5.2
Homebrew/homebrew-core (git revision 49d84ebfb3f; last commit 2022-06-15)
Homebrew/homebrew-cask (git revision 763a50c0b5; last commit 2022-06-15)

sebastian@Juans-MBP Downloads % python3 --version
Python 3.8.0
KMurphs commented 2 years ago

Did you fix this issue?

TheSoldier103 commented 2 years ago

I haven't fixed this issue. Has anyone fixed it?

Tksn07 commented 2 years ago

I faced the same issue

sriram-mv commented 2 years ago

What do you see when you run ..../python3.8 -Im ensurepip --upgrade --default-pip (I have truncated the path here, since it could different for folks) directly on the command line? do you see a traceback?

Dry-Wi commented 2 years ago

I faced the same issue as well

djfurman commented 2 years ago

Plus 1, I'm seeing this on my new M1Max trying to setup.

djfurman commented 2 years ago

I'm seeing a report for

aws-sam-cli installation fails on macOS 11.3.1 because of missing python@3.8 https://github.com/aws/homebrew-tap/issues/207
Installing aws-sam-cli with homebrew on Mac: This error originates from a subprocess, and is likely not a problem with pip https://github.com/aws/homebrew-tap/issues/369

However, python@3.8 is successfully installed via brew (by this dependency)

/opt/homebrew/opt/python@3.8/libexec/bin/python --version
Python 3.8.14

Steps Attempted

Then attempting to test, ran brew install aws-sam-cli, =>

brew install aws-sam-cli
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).

Warning: aws/tap/aws-sam-cli 1.57.0 is already installed and up-to-date.
To reinstall 1.57.0, run:
  brew reinstall aws-sam-cli

However sam is not anywhere in the path.

Trying again, with attempting brew's recommendation to reinstall, I hit the same error.

djfurman commented 1 year ago

Found a work around!

Circumstance

If you have to setup a ~/.pip/pip.conf for a proxy, non-PyPI mirror, or other settings; you'll like run into what I did above.

It's like the installer is somehow ignoring my local user settings, my PATH for the system Python I run, and all of my environment variables (which I have set for PIP). I can't explain why this works, but on a suggestion from a colleague I tried this and it was instant resolution.

Implementing the work around

  1. Create /Library/Application\ Support/pip/pip.conf (note this is the root (/Library) version without the hidden directory with the contents of pip.conf identical to your local user.
  2. Run brew install aws-sam-cli
  3. Everything runs and installas as expected!

Hope this helps someone else stuck here where I was!