Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtualenv could not find python after successful install #141

Open
1 task done
alvincrespo opened this issue Feb 27, 2023 · 3 comments
Open
1 task done

virtualenv could not find python after successful install #141

alvincrespo opened this issue Feb 27, 2023 · 3 comments

Comments

@alvincrespo
Copy link

1. Please specify the following:

  • OS: [e.g. OS X, Ubuntu, Windows, etc.]: OS X 12.6.1

  • Shell (Bash, PowerShell, Zsh, etc.): Zsh

  • 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?

@chis-dd
Copy link

chis-dd commented Mar 2, 2023

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.

@alvincrespo
Copy link
Author

alvincrespo commented Mar 6, 2023

@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.)

@GabeK0
Copy link

GabeK0 commented May 27, 2023

Here's what worked for me on MacOS:

  1. whereis eb eb: /Users/[your_username_here]/.ebcli-virtual-env/executables/eb to find the eb installation
  2. open -a TextEdit /Users/[your_username_here]/.ebcli-virtual-env/executables/eb to open a text editor of the file
  3. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants