AWS SAM CLI Fresh install throws error - dyld: Library not loaded: @executable_path/../.Python
Asked Answered
I

4

13

I am trying to use the AWS SAM CLI installed through Homebrew and I am seeing the following error when I try to use sam with any command:

dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /usr/local/Cellar/aws-sam-cli/0.53.0/libexec/bin/python3.7
  Reason: image not found

Looking at the .Python file referenced in the error, it is symlinked to a python folder that doesn't actually exist:

drwxr-xr-x   7 RCR  staff   224 Jun 16 19:40 .
drwxr-xr-x   9 RCR  staff   288 Jul  8 14:55 ..
lrwxr-xr-x   1 RCR  staff    70 Jun 16 19:40 .Python -> ../../../../opt/python/Frameworks/Python.framework/Versions/3.7/Python
drwxr-xr-x  39 RCR  staff  1248 Jul  8 14:55 bin
drwxr-xr-x   3 RCR  staff    96 Jun 16 19:40 include
drwxr-xr-x   3 RCR  staff    96 Jun 16 19:40 lib
-rw-r--r--   1 RCR  staff    61 Jun 16 19:40 pip-selfcheck.json

I do not have a 3.7 folder at that location, but I do have a 3.8 folder. That said, I am not sure what is the origin of this folder. My Python3 installation is from Homebrew and located in the Cellar as usual (../Cellar/[email protected]/3.8.3_1/bin/python3) and symlinked to /usr/local/bin/python3. Not sure if that is relevant but I figure more info can't hurt.

I tried symlinking the .Python file to the 3.8 version I do have at that location but it only produced other errors.

Any idea how I can get this CLI working?

Isolationism answered 8/7, 2020 at 19:9 Comment(0)
N
19

Looks like 0.53.0 comes with python3.7 executables, there is a workaround until it is fixed:

brew install --build-from-source aws-sam-cli

https://github.com/awslabs/aws-sam-cli/issues/2101

https://github.com/aws/homebrew-tap/issues/93

Natica answered 9/7, 2020 at 7:34 Comment(2)
This works for me brew reinstall --build-from-source aws-sam-cliHightest
Ha, those github issues where both added just after I stopped looking there and come and ask here. Anyway. This seemed to do the trick. I assume that later down the line, when there is an update without the issue, brew upgrade will be enough?Isolationism
W
1

I have the same problem (but not a fresh install). I updated brew today and sam stopped working.

Until someone posts a fix, here's a workaround that worked for me:

pip3 install aws-sam-cli
Watusi answered 9/7, 2020 at 2:23 Comment(1)
May I ask where you found that you could install using just pip3? Thank youIsolationism
A
0

I had the same problem and ended up ditching homebrew for aws-sam-cli.

% brew uninstall aws-sam-cli
% pip3 install aws-sam-cli --user

I also had to add /Users/**MY_USER_NAME**/Library/Python/3.7/bin to my $PATH.

% vi ~/.zshrc

# Add
export PATH="/Users/**MY_USER_NAME**/Library/Python/3.7/bin:$PATH"

% source ~/.zshrc
Awry answered 9/7, 2020 at 7:30 Comment(0)
J
0

Run the following command to upgrade the SAM CLI

brew upgrade aws/tap/aws-sam-cli

Julianejuliann answered 15/12, 2020 at 23:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.