1

I am trying to deploy a lambda with the AWS CLI. It was working a few months ago but now it's not.

Followed these instructions to install the CLI: https://docs.aws.amazon.com/cli/latest/userguide/install-macos.html

Results:

➜  lambda git:(master) ✗ pip3 install awscli --upgrade --user
Requirement already up-to-date: awscli in /Users/justin/Library/Python/3.7/lib/python/site-packages (1.16.310)
[... and so on, it's already installed] 

➜  lambda git:(master) ✗ brew uninstall awscli
Error: No such keg: /usr/local/Cellar/awscli

➜  lambda git:(master) ✗ python --version
Python 2.7.17

➜  lambda git:(master) ✗ pip3 --version
pip 19.3.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

➜  lambda git:(master) ✗ python3 --version
Python 3.7.6

➜  lambda git:(master) ✗ aws --version
dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /usr/local/aws/bin/python2.7
  Reason: image not found
[1]    42316 abort      aws --version

Clearly something is borked with my Python install. I've been messing around with this for close to 45 minutes now (reinstalling everything mostly and trying some posts like this one) but I'm no closer to solving it than I was when I started.

jcollum
  • 43,623
  • 55
  • 191
  • 321
  • This is a workaround suggestion rather than an answer (thus the comment), but you might want to try doing this in a virtualenv configured to use python 3.7, which should get you around the problem the `aws` executable is having. (Your pip3 install is, of course, referencing python3, but python-2.7 seems to be what's in your path.) – jrheling Jan 06 '20 at 02:49
  • This Python3 / 2 thing is a pain – jcollum Jan 06 '20 at 17:55

1 Answers1

4

Chip Cullen had the fix: https://chipcullen.com/fixing-bad-interpreter-error-aws-python-3_7/

This is because you’ve probably installed awscli in the past, but more recently upgraded your system Python to version 3.7, not 3.6 (which old versions of awscli worked with).

Short version:

brew reinstall awscli

brew link --overwrite awscli
jcollum
  • 43,623
  • 55
  • 191
  • 321