3

Deploying to AWS failed, requirement.txt returned non-zero exit status 1

I get the following error when trying to deploy my Flask app on AWS beanstalk with python 3.6:

Flask deploy ERROR

I checked this similar post AWS Elastic Beanstalk - python - Your requirements.txt is invalid , in which they suggest making a .config file inside an .ebextensions directory, however I can't name a folder .ebextensions as I am working on a Mac, and a pop up window will appear impeding you if you try. I created this directory and file on my terminal and then tried to zip the whole thing there as well (since .ebextensions does not show in Finder), but the .ebextensions folder is empty.

I am trying a very simple Flask application to start with, here is my application.py

#Basic modules for a Flask app to work (set Flask app, return HTML template for specific @application.route, redirect to a different
#@application.route, generate URL to a given endpoint).
from flask import Flask, render_template, redirect, url_for

#Set Flask application object
application = Flask(__name__) 
application.config['SECRET_KEY'] = 'ants' 

@application.route('/', methods=['GET', 'POST'])
@application.route('/home', methods=['GET', 'POST']) 
def index():
    return render_template('project_homepage.html')

if __name__ == '__main__':
    application.run()

My project_homepage.html (it should just return a blue background), inside the templates folder

<doctype html>
<html lang="en">
  <head>

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.1/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.16/js/jquery.dataTables.min.js"></script>
<title> Network Visualizer </title>
</head>






<body style="background-color:#dee8eb;border: 1px solid #7ea4b3">
  
<div style="background-color:#dee8eb;width:100%;height:20px " class="container"></div>




</body>

</html>
</doctype>

and my requirements.txt (a lot of packages since my actual application is much more complex, but I am trying with a basic one to get the gist of AWS)


aniso8601==8.0.0
appnope==0.1.0
asn1crypto==1.2.0
attrs==19.3.0
backcall==0.1.0
beautifulsoup4==4.9.1
bower==0.0.0
cairocffi==1.1.0
certifi==2019.11.28
cffi==1.14.0
chardet==3.0.4
chart-studio==1.1.0
Click==7.0
community==1.0.0b1
conda==4.8.3
conda-package-handling==1.6.0
configparser==5.0.0
cryptography==2.8
cycler==0.10.0
decorator==4.4.2
django-mathfilters==1.0.0
Flask==1.1.1
Flask-Cors==3.0.8
Flask-HTTPAuth==4.1.0
Flask-RESTful==0.3.8
Flask-WTF==0.14.2
future==0.18.2
idna==2.8
importlib-metadata==1.6.0
ipython==7.13.0
ipython-genutils==0.2.0
itsdangerous==1.1.0
jedi==0.16.0
Jinja2==2.11.0
kiwisolver==1.1.0
lxml==4.5.2
MarkupSafe==1.1.1
matplotlib==3.2.1
more-itertools==8.2.0
networkx==2.4
npm==0.1.1
numpy==1.19.0
optional-django==0.1.0
packaging==20.3
pandas==1.0.0
parso==0.6.2
pexpect==4.8.0
pickleshare==0.7.5
plotly==4.5.0
pluggy==0.13.1
prompt-toolkit==3.0.4
psutil==5.6.7
ptyprocess==0.6.0
py==1.8.1
pycosat==0.6.3
pycparser==2.19
Pygments==2.6.1
pyOpenSSL==19.0.0
pyparsing==2.4.6
pyreadr==0.2.9
PySocks==1.7.1
pytest==5.4.1
python-dateutil==2.8.1
python-louvain==0.14
pytz==2019.3
pyvis==0.1.7.0
requests==2.22.0
retrying==1.3.3
ruamel-yaml==0.15.46
scikit-network==0.18.0
scipy==1.4.1
seaborn==0.10.0
simple-http-server==0.1.7
simplegeneric==0.8.1
six==1.12.0
soupsieve==2.0.1
SQLAlchemy==1.3.13
timeloop==1.0.2
tqdm==4.36.1
traitlets==4.3.3
tzlocal==2.0.0
urllib2-file==0.2.1
urllib3==1.24.2
wcwidth==0.1.9
Werkzeug==0.16.1
WTForms==2.2.1
xlrd==1.2.0
zipp==3.1.0

Any help is greatly appreciated! Thank you.

Andrew

baldr
  • 2,891
  • 11
  • 43
  • 61
andrew_helpme
  • 33
  • 1
  • 5
  • Can you login into the EB instance, and manually try running `requirements.txt` with pip3. Also which EB version are you using? Based on Amazon Linux 1 or 2? – Marcin Oct 08 '20 at 21:30
  • Hi, it's based on Amazon Linux 2. I am not sure what you mean by manually running the requirements.txt in the EB instance (do you mean in the AWS platform or on my terminal? sorry, I have never used AWS before). Thank you for your help! :) – andrew_helpme Oct 09 '20 at 14:06
  • I am facing similar issue for my Django application. Did you get any solution for this? – Amol Chakane May 04 '21 at 10:25

0 Answers0