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

SyntaxError: invalid syntax On Running eb command. #138

Open
1 task done
PranuPranav97 opened this issue Oct 4, 2022 · 4 comments
Open
1 task done

SyntaxError: invalid syntax On Running eb command. #138

PranuPranav97 opened this issue Oct 4, 2022 · 4 comments

Comments

@PranuPranav97
Copy link

PranuPranav97 commented Oct 4, 2022

1. Please specify the following:

  • OS: [Ubuntu 20.04]: ___

  • Shell (Bash): ____

  • I have reviewed the troubleshooting tips described here and they do not solve my problem

2. Description
I installed EB cli from this link using commands https://github.com/aws/aws-elastic-beanstalk-cli-setup
Whenever I run eb command it shows the error:
`Error processing line 1 of /home/$user/.ebcli-virtual-env/lib/python3.8/site-packages/distutils-precedence.pth:

Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 158, in addpackage
exec line
File "", line 1, in
File "/home/$user/.ebcli-virtual-env/lib/python3.8/site-packages/distutils_hack/init.py", line 194
f'spec_for
{name}',
^
SyntaxError: invalid syntax
`

@jadbox
Copy link

jadbox commented Oct 15, 2022

Same issue here

@alejo4373
Copy link

alejo4373 commented Oct 23, 2022

I think there might be a missing instruction in the README to activate the virtualenv create before using eb.

When I'd run

eb --version

I would get the following output

Error processing line 1 of /Users/alejandrofranco/.ebcli-virtual-env/lib/python3.10/site-packages/distutils-precedence.pth:

  Traceback (most recent call last):
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 152, in addpackage
      exec line
    File "<string>", line 1, in <module>
    File "/Users/alejandrofranco/.ebcli-virtual-env/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 194
      f'spec_for_{name}',
                       ^
  SyntaxError: invalid syntax

Remainder of file ignored
EB CLI 3.20.3 (Python 3.10.)

It seems the eb executable needs to be called with the virtualenv that was created (usually ~/.ebcli-virtual-env) activated. To learn how to use virtualenv and activate a specific environment, I watched Corey Schafer tutorial

Essentially, activate the environment

source ~/.ebcli-virtual-env/bin/activate

Then running

eb --version

Doesn't give the error and I simply see the following output

EB CLI 3.20.3 (Python 3.10.)

To deactivate the virtualenv run

deactivate

@slavking
Copy link

slavking commented Feb 27, 2023

same problem here, bash version 5.1.16(1)-release (x86_64-apple-darwin21.1.0) on MacOS 12.2 (21D49)

$ eb --version
Error processing line 1 of /Users/home/.ebcli-virtual-env/lib/python3.10/site-packages/distutils-precedence.pth:

  Traceback (most recent call last):
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 152, in addpackage
      exec line
    File "<string>", line 1, in <module>
    File "/Users/home/.ebcli-virtual-env/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 194
      f'spec_for_{name}',
                       ^
  SyntaxError: invalid syntax

Remainder of file ignored
EB CLI 3.20.3 (Python 3.10.)

@pmccaughtry
Copy link

I had the same issue and resolved with a combination of activating the virtual environment as recommended by @alejo4373 followed by issuing a command in the virtual environment to install an older version of urllib3. I found a Stack overflow article regarding similar errors with AWS Lambda stating that botocore does not support urllib3 v2+ (https://stackoverflow.com/questions/76414514/cannot-import-name-default-ciphers-from-urllib3-util-ssl-on-aws-lambda-us)

$ source ~/.ebcli-virtual-env/bin/activate
$ pip install --force-reinstall -v "urllib3==1.26.16"
$ eb --version
EB CLI 3.20.6 (Python 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0])

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

5 participants