I am fairly new to Python, Flask
and hosting a public-facing website. I have a Flask/Python application created, and it works great locally (windows). I am using a MySQL database hosted at AWS RD. I am trying to host my Flask/Python app at Elastic Beanstalk. I believe I am having trouble with the MySql-related Python packages in my requirements.txt
file. When creating the application and environment at Elastic Beanstalk, it fails. I've tried removing the MySql-related packaged from requirements.txt. Then, it loads and hosts fine until I try to interact with the database at which time it fails. I hope someone can help! With Elastic Beanstalk I am not using a Linux command line, and am fairly weak in that area which is why I went to Elastic Beanstalk.
My Requirements.txt File:
alembic==1.7.3
awsebcli==3.20.2
blinker==1.4
botocore==1.21.48
cement==2.8.2
certifi==2021.5.30
cffi==1.14.5
charset-normalizer==2.0.6
click==7.1.2
colorama==0.4.3
cryptography==3.4.6
dnspython==2.1.0
dominate==2.6.0
email-validator==1.1.2
Flask==1.1.2
Flask-Bootstrap==3.3.7.1
Flask-CLI==0.4.0
Flask-DotEnv==0.1.2
Flask-Login==0.5.0
Flask-Mail==0.9.1
Flask-Migrate==2.6.0
Flask-Moment==0.11.0
Flask-SQLAlchemy==2.4.4
Flask-WTF==0.14.3
future==0.16.0
idna==3.1
itsdangerous==1.1.0
Jinja2==2.11.3
jmespath==0.10.0
Mako==1.1.4
MarkupSafe==1.1.1
mysqlclient==2.0.3
pathspec==0.5.9
pycparser==2.20
PyJWT==2.0.1
PyMySQL==1.0.2
pypiwin32==223
python-dateutil==2.8.1
python-dotenv==0.15.0
python-editor==1.0.4
pywin32==301
PyYAML==5.4.1
requests==2.26.0
semantic-version==2.8.5
six==1.14.0
SQLAlchemy==1.3.23
termcolor==1.1.0
urllib3==1.26.7
visitor==0.1.3
wcwidth==0.1.9
Werkzeug==1.0.1
WTForms==2.3.3
Portion of Error Log received when running 'eb create' to create application and environment at Elastic Beanstalk
Collecting mysqlclient==2.0.3
Downloading mysqlclient-2.0.3.tar.gz (88 kB)
2021/09/26 19:29:44.931423 [ERROR] An error occurred during execution of command [app-deploy] - [InstallDependency]. Stop running the command. Error: fail to install dependencies with requirements.txt file with error Command /bin/sh -c /var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt failed with error exit status 1. Stderr: ERROR: Command errored out with exit status 1:
command: /var/app/venv/staging-LQM1lest/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-npwpdjpr/mysqlclient_ca5f80f8bcde427583d79e69a12d5afc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-npwpdjpr/mysqlclient_ca5f80f8bcde427583d79e69a12d5afc/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-b5unzxiz
cwd: /tmp/pip-install-npwpdjpr/mysqlclient_ca5f80f8bcde427583d79e69a12d5afc/
Complete output (15 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-npwpdjpr/mysqlclient_ca5f80f8bcde427583d79e69a12d5afc/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-npwpdjpr/mysqlclient_ca5f80f8bcde427583d79e69a12d5afc/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-npwpdjpr/mysqlclient_ca5f80f8bcde427583d79e69a12d5afc/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config –version
mysql_config --libs
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/3c/df/59cd2fa5e48d0804d213bdcb1acb4d08c403b61c7ff7ed4dd4a6a2deb3f7/mysqlclient-2.0.3.tar.gz#sha256=f6ebea7c008f155baeefe16c56cd3ee6239f7a5a9ae42396c2f1860f08a7c432 (from https://pypi.org/simple/mysqlclient/) (requires-python:>=3.5). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mysqlclient==2.0.3 (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3)ERROR: No matching distribution found for mysqlclient==2.0.3
2021/09/26 19:29:44.931435 [INFO] Executing cleanup logic
2