AWS ElasticBeanstalk CLI in OS X: EB Command Not Found
Asked Answered
A

9

21

I am running into an error attempting to run the ElasticBeanstalk CLI tools on Mac OSX. I have been troubleshooting path issues and hope someone can shed some light. Here is my set up.

I am running Mac OS X El Capital 10.11.6, and I have manually installed Python 3.4 (via the download installer on python.org). I can see that it is installed correctly in /Library/Frameworks/Python.frameworks/Versions. Commands beginning with python3 work as expected. I have also installed the the AWS ElasticBeanstalk CLI tools by running sudo pip3 install --upgrade awsebcli and can confirm it is located in the /Users/myuser/Library/Python/3.4/lib/python/site-packages/ directory.

I have experimented with modifying my ~/.bash_profile, as well as removing it. When I run echo $PATH, here is my output:

/Users/myuser/Library/Python/3.4/lib/python/site-packages/ebcli/:
/Library/Frameworks/Python.framework/Versions/3.4/lib/python/site-packages:
/Library/Frameworks/Python.framework/Versions/3.4/bin:
/Users/myuser/.rvm/gems/ruby-2.2.4/bin:
/Users/myuser/.rvm/gems/ruby-2.2.4@global/bin:
/Users/myuser/.rvm/rubies/ruby-2.2.4/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/opt/X11/bin:
/usr/local/git/bin:
/Users/myuser/.rvm/bin

Here is my ~/.bash_profile

# Load the default .profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" 

# Load RVM into a shell session *as a function*
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"

# Setting PATH for Python 3.4 site packages
PATH="/Library/Frameworks/Python.framework/Versions/3.4/lib/python/site-packages:${PATH}"
PATH="/Users/myuser/Library/Python/3.4/lib/python/site-packages/ebcli/:${PATH}"
export PATH
Astridastride answered 3/1, 2017 at 21:53 Comment(4)
Can you paste the error as well? the aws command is not found at all? Did you try to install it in a virtualenv with -p python3 to see if that's broken as well?Plains
Also you should not add the site-packages in your PATH, those are libraries not (necessarily) binaries.Plains
Thanks, Maresh! I had added that based on a couple of SO posts, like this one: #33302872 Which part should I take out? This line? PATH="/Library/Frameworks/Python.framework/Versions/3.4/lib/python/site-packages:${PATH}" or this one? PATH="/Users/myuser/Library/Python/3.4/lib/python/site-packages/ebcli/:${PATH}" Or both?Astridastride
Also, to answer your first question, the error I get when I run eb --version is this: -bash: eb: command not foundAstridastride
A
32

After a lot more trial and error, I finally got this working. Here are the steps I took.

  1. Installed the AWS CLI tools for Python 3+.

    pip3 install awscli 
    
  2. Uninstalled the EB CLI for /System/Library/Python.

    pip3 uninstall awsebcli
    
  3. Uninstalled the EB CLI for /Library/Python.

    pip3 uninstall awsebcli
    
  4. Installed the EB CLI for /Library/Python with pip.

    pip3 install awsebcli
    
  5. Removed the paths to the site packages directories from my ~/.bash_profile.

  6. Added the following to my ~/.bash_profile.

    # Setting the path for Python 3.4
    PATH="/Library/Frameworks/Python.framework/Versions/3.4:${PATH}"
    export PATH
    
  7. Opened a new terminal window. (Can also run source ~/.bash_profile).

  8. Changed into the project directory.

  9. Ran eb --version and got the following output:

    EB CLI 3.9.0 (Python 3.4.4)
    

I realize it's uncool to post one's own answer, but hopefully my trial and error will be helpful to someone else with messed up paths.

Astridastride answered 4/1, 2017 at 1:18 Comment(3)
No it's good that you post your solution. You can even approve it in a few hours and you get a badge for that :)Plains
Thank you! In the third step, I think you meant pip3 uninstall awsebcli instead of pip uninstall awsebcli, that's what worked for me 👍Indefensible
Seeing this answer, I tried uninstalling awsebcli, then installing the awscli, after which I reinstalled awsebcli. Worked like a charm!Demetriusdemeyer
Y
22

This did it for me on Mac:

brew install awsebcli

From: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install-osx.html

Yan answered 26/3, 2018 at 15:34 Comment(1)
Error: The following directories are not writable by your user: /usr/local/share/man/man8Harangue
C
10

I faced the same problem. Just upgrading the awsebcli can help : pip install --upgrade awsebcli

Char answered 28/2, 2017 at 15:9 Comment(2)
Incredible that this worked like a charm. I just upgraded as you said and eb --version echoed. Thanks.Decrypt
On Windows 10, eb --version resulted in "not recognized as an internal or external command, operable program or batch file"; and this command pip install --upgrade awsebcli helped.Predicable
C
3

I had the same problem, I followed the instructions provided on aws official doc and it worked.

  1. git clone https://github.com/aws/aws-elastic-beanstalk-cli-setup.git
  2. ./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
  3. echo 'export PATH="/home/<YOUR_USERNAME>/.ebcli-virtual-env/executables:$PATH"' >> ~/.bash_profile && source ~/.bash_profile

Then eb --version gave the expected output :

EB CLI 3.15.3 (Python 3.7.2)

Consecutive answered 26/9, 2019 at 19:57 Comment(0)
K
1

Was having Zsh, this is what worked for me. Installed the latest python package from the main python website, and then:

export PATH=/Library/Frameworks/Python.framework/Versions/3.6/bin:$PATH

And setting the profile to

$ source ~/.zshrc

Installed, pip3 install awscli and pip3 install awsebcli

Check version to verify:

eb --version // EB CLI 3.12.4 (Python 3.6.4)

Hope this helps.

Kreutzer answered 17/3, 2018 at 13:23 Comment(0)
S
1

Homebrew Solution

When upgrading to macOS Big Sur, my eb cli command stopped working. The shebang line in my /usr/local/bin/eb file was referencing an old version of python that got blown away with the os upgrade.

I upgraded and re-linked the awsebcli and all is now working again.

brew upgrade awsebcli
brew link --overwrite aws-elasticbeanstalk
eb --version
Sweeper answered 24/2, 2021 at 17:21 Comment(0)
C
1

I had the same issue. Do not run "pip install awsebcli --upgrade --user" when you install it for the first time! Run "pip install awsebcli" instead.

Steps to fix it:

  • pip uninstall awsebcli;
  • pip install awsebcli;
  • pip install awsebcli --upgrade --user;

After all above steps "eb --version" should display the correct version with no errors.

Canvass answered 27/9, 2022 at 16:11 Comment(0)
M
0

I get this warning when reinstall awsebcli: WARNING: The scripts eb and ebp are installed in '/Users//Library/Python/3.8/bin' which is not on PATH.

In this case just add below path into your ~/.bash_profile is working fine.

export PATH=/Users/<you>/Library/Python/3.8/bin:$PATH
Marshall answered 22/7, 2022 at 6:39 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Myke
B
0

In Sonoma macOS 14 Uninstall from pip if you did

pip3 uninstall awsebcli

And then

brew install awsebcli
brew link --overwrite aws-elasticbeanstalk
eb --version
Bindweed answered 18/10, 2023 at 19:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.