aws-elastic-beanstalk-cli-setup
aws-elastic-beanstalk-cli-setup copied to clipboard
virtualenv could not find python after successful install
1. Please specify the following:
-
OS: [e.g. OS X, Ubuntu, Windows, etc.]: OS X 12.6.1
-
Shell (Bash, PowerShell, Zsh, etc.): Zsh
-
[x] I have reviewed the troubleshooting tips described here and they do not solve my problem
2. Description After a successful install, I am receiving the following message:
➜ ~ git:(main) ✗ python ./aws-elastic-beanstalk-cli-setup/scripts/ebcli_installer.py
***********************************
1. Locating virtualenv installation
***********************************
....
***************
6. Finishing up
***************
Success!
EBCLI has been installed.
➜ ~ git:(main) ✗ eb --version
env: python: No such file or directory
This is my current environment:
➜ ~ git:(main) ✗ virtualenv --version
virtualenv 20.19.0 from /usr/local/lib/python3.9/site-packages/virtualenv/__init__.py
➜ ~ git:(main) ✗ which python
python: aliased to python3
➜ ~ git:(main) ✗ which python3
/usr/local/bin/python3
I have python installed via homebrew. Not sure if that creates an issue with the install process?
Hey i just experienced this issue this fixed it for me.
I went and found where eb was installed.
whereis eb eb: /Users/chis-dd/.ebcli-virtual-env/executables/eb
Then i ran the file in visual studio code, trying to debug it. It worked but i noticed it was using a different python version from my default.
/opt/homebrew/bin/python3.11
So try running with all the different python3 versions you have.
Once one of them works add this to ./zshrc and restart your terminal.
export PATH="$HOMEBREW_PREFIX/opt/python@<version-which-worked>/libexec/bin:$PATH"
Run eb -v again and it should work.
@chis-dd You rock! Thanks for the help here. This is what I did:
eb --version
doesn't work
➜ ~ git:(main) ✗ eb --version
pyenv: python: command not found
The `python' command exists in these Python versions:
3.9.11
Note: See 'pyenv help global' for tips on allowing both
python2 and python3 to be found.
Review pyenv help global
➜ ~ git:(main) ✗ pyenv help global
Usage: pyenv global <version> <version2> <..>
Sets the global Python version(s). You can override the global version at
any time by setting a directory-specific version with `pyenv local'
or by setting the `PYENV_VERSION' environment variable.
<version> can be specified multiple times and should be a version
tag known to pyenv. The special version string `system' will use
your default system Python. Run `pyenv versions' for a list of
available Python versions.
Example: To enable the python2.7 and python3.7 shims to find their
respective executables you could set both versions with:
'pyenv global 3.7.0 2.7.15'
Check current python version with python --version
🚧 This was the core issue. I had not set a python version fro my environment.
➜ ~ git:(main) ✗ python --version
pyenv: python: command not found
The `python' command exists in these Python versions:
3.9.11
Note: See 'pyenv help global' for tips on allowing both
python2 and python3 to be found.
Set the global python version with python global
➜ ~ git:(main) ✗ pyenv global 3.9.11
Verify eb
works
➜ ~ git:(main) ✗ eb --version
EB CLI 3.20.3 (Python 3.11.)
Here's what worked for me on MacOS:
-
whereis eb eb: /Users/[your_username_here]/.ebcli-virtual-env/executables/eb
to find the eb installation -
open -a TextEdit /Users/[your_username_here]/.ebcli-virtual-env/executables/eb
to open a text editor of the file - Replace line 1 from
#!/usr/bin/env python
to#!/usr/bin/env python3
Looks like it was trying to run python via the python
command, but my set up requires the python3
command