1

Just yesterday everything worked fine on our AWS ElasticBeanstalk continuous deployment, but today suddenly fails with the following errors:

$ pip install awsebcli -q --upgrade
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
$ eb deploy production
Traceback (most recent call last):
  File "/usr/local/bin/eb", line 5, in <module>
    from ebcli.core.ebcore import main
  File "/usr/local/lib/python2.7/dist-packages/ebcli/core/ebcore.py", line 19, in <module>
    from ebcli.core import ebglobals, base, hooks
  File "/usr/local/lib/python2.7/dist-packages/ebcli/core/hooks.py", line 20, in <module>
    from ebcli.core import fileoperations
  File "/usr/local/lib/python2.7/dist-packages/ebcli/core/fileoperations.py", line 32, in <module>
    from json import load, JSONDecodeError
ImportError: cannot import name JSONDecodeError
Cleaning up file based variables
00:00
ERROR: Job failed: exit code 1

Our initial deploy script assumed python version 2.7 and installation of awsebcli. Here is the snippet from the script:

 - apt-get update -y
 - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
 - python get-pip.py
 - pip --version
 - pip install --upgrade pip setuptools
 - pip install awsebcli -q --upgrade
 - eb deploy production

But after receiving this error I decided to swap to python3 and install pip3 instead. Here is the updated script and what it throws:

    - apt-get update -y
    - apt-get install -y python3-pip
    - update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
    - update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2
    - update-alternatives --list python
    - python --version
    - pip3 --version
    - pip3 install awsebcli -q --upgrade
    - eb deploy production
$ update-alternatives --list python
/usr/bin/python2.7
/usr/bin/python3.5
$ python --version
Python 3.5.3
$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)
$ pip3 install awsebcli -q --upgrade
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-0a4fa4ab/awsebcli/
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1

There is no explicit error message thrown, so I can't understand why exactly it exits with code 1. Can you please suggest anything?

1

Update:

The import of JSONDecoderError from json module is a valid syntax only starting from Python 3.5, while in previous versions it was a subclass of ValueError class. Apparently the latest version of awsebcli 3.20.0 should launch with python >= 3.5 instead of python <= 2.7.


Apparently nothing suggested worked for me. Though I used the official aws eb cli setup script and followed the instructions with dependencies and verifying paths to executables. Details here.

Final working script would look like this:

$ apt-get update -y
$ apt-get install -y build-essential zlib1g-dev libssl-dev libncurses-dev libffi-dev libsqlite3-dev libreadline-dev libbz2-dev
$ git clone https://github.com/aws/aws-elastic-beanstalk-cli-setup.git
$ ./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
$ echo 'export PATH="/root/.ebcli-virtual-env/executables:$PATH"' >> ~/.bash_profile && source ~/.bash_profile
$ echo 'export PATH=/root/.pyenv/versions/3.7.2/bin:$PATH' >> /root/.bash_profile && source /root/.bash_profile
$ eb deploy production

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.