Amazon EB:部署Django应用程序,为什么要安装mysqlclient2.2.0?

问题描述 投票:0回答:1

我一直在创建和部署 django 应用程序以进行测试。(平台:在 64 位 Amazon Linux 2 上运行的 Python 3.8)当我创建环境时,我执行“eb deploy”命令。部署后报错,并提示读取“eb-engine.log”,我去读了一下,发现它一直在尝试安装mysqlclient。这是错误日志:


Collecting mysqlclient
  Downloading mysqlclient-2.2.0.tar.gz (89 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.5/89.5 KB 21.4 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'

2023/11/03 14:56:16.688243 [INFO]   error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      Trying pkg-config --exists mysqlclient
      Command 'pkg-config --exists mysqlclient' returned non-zero exit status 1.
      Trying pkg-config --exists mariadb
      Command 'pkg-config --exists mariadb' returned non-zero exit status 1.
      Traceback (most recent call last):
        File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-1qzq0x_u/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-1qzq0x_u/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-1qzq0x_u/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 154, in <module>
        File "<string>", line 48, in get_config_posix
        File "<string>", line 27, in find_package_name
      Exception: Can not find valid pkg-config name.
      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

2023/11/03 14:56:16.688267 [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: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      Trying pkg-config --exists mysqlclient
      Command 'pkg-config --exists mysqlclient' returned non-zero exit status 1.
      Trying pkg-config --exists mariadb
      Command 'pkg-config --exists mariadb' returned non-zero exit status 1.
      Traceback (most recent call last):
        File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-1qzq0x_u/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-1qzq0x_u/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-1qzq0x_u/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 154, in <module>
        File "<string>", line 48, in get_config_posix
        File "<string>", line 27, in find_package_name
      Exception: Can not find valid pkg-config name.
      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

注意:此错误源自子进程,并且可能不是 pip 的问题。

已经用pip卸载了mysqlclient,并将其从我的requirements.txt中删除 这是我的要求.txt

> aiofiles==23.1.0
> alembic==1.4.1
> ansicolors==1.1.8
> antlr4-python3-runtime==4.8
> appnope==0.1.2
> asgiref==3.5.0
> asttokens==2.0.5
> attrs==21.4.0
> autopage==0.5.1
> autopep8==1.6.0
> awsebcli==3.20.10
> azure-core==1.24.1
> azure-storage-blob==12.12.0
> backcall==0.2.0
> bcrypt==3.2.2
> bleach==5.0.1
> blessed==1.20.0
> boto==2.49.0
> botocore==1.31.69
> bx-py-utils==67
> cement==2.8.2
> certifi==2021.10.8
> cffi==1.15.0
> chardet==5.1.0
> charset-normalizer==2.0.12
> click==8.1.3
> cliff==3.10.1
> cloudpickle==2.1.0
> cmaes==0.8.2
> cmd2==2.4.1
> colorama==0.4.3
> colorlog==6.6.0
> configparser==5.2.0
> cryptography==36.0.2
> cssselect==1.1.0
> cycler==0.11.0
> databricks-cli==0.17.0
> debugpy==1.5.1
> decorator==5.1.1
> decouple==0.0.7
> defusedxml==0.7.1
> distlib==0.3.4
> distro==1.7.0
> Django==4.0.3
> django-allauth==0.49.0
> django-cleanup==6.0.0
> django-cors-headers==3.11.0
> django-countries==7.3.2
> django-crispy-forms==1.13.0
> django-embed-video==1.4.4
> django-environ==0.9.0
> django-extensions==3.1.5
> django-fastdev==1.7.2
> django-forms-dynamic==1.0.0
> django-groups-manager==1.2.0
> django-guardian==2.4.0
> django-gulp==4.1.0
> django-js-asset==2.0.0
> django-jsignature==0.11
> django-mptt==0.13.4
> django-rest-auth==0.9.5
> django-rest-resetpassword==0.1.2
> django-storages==1.14.2
> django-tools==0.51.0
> django-tz-detect==0.4.0
> djangorestframework==3.13.1
> docker==5.0.3
> docker-compose==1.29.2
> dockerpty==0.4.1
> docopt==0.6.2
> entrypoints==0.4
> env-tools==2.2.0
> et-xmlfile==1.1.0
> executing==0.8.3
> filelock==3.7.1
> Flask==2.1.2
> flatten-json==0.1.13
> fpdf2==2.5.0
> gitdb==4.0.9
> GitPython==3.1.27
> greenlet==1.1.2
> gunicorn==20.1.0
> hashids==1.3.1
> hydra-core==1.1.2
> icdiff==2.0.5
> idna==3.3
> imbalanced-learn==0.9.0
> imblearn==0.0
> importlib-metadata==4.11.4
> install==1.3.5
> ipykernel==6.9.1
> ipython==8.1.1
> isodate==0.6.1
> itsdangerous==2.1.2
> jedi==0.18.1
> Jinja2==3.1.2
> jmespath==1.0.1
> joblib==1.1.0
> jsonfield==3.1.0
> jsonschema==3.2.0
> jupyter-client==7.1.2
> jupyter-core==4.9.2
> kiwisolver==1.4.3
> lml==0.1.0
> lxml==4.9.0
> Mako==1.2.0
> MarkupSafe==2.1.1
> matplotlib==3.4.3
> matplotlib-inline==0.1.3
> mlflow==1.13.1
> msrest==0.7.1
> mysql==0.0.3
> mysql-connector-python==8.0.28
> nest-asyncio==1.5.4
> numpy==1.23.0
> oauthlib==3.2.0
> omegaconf==2.1.1
> openpyxl==3.0.9
> optuna==2.10.0
> packaging==21.3
> pandas==1.4.3
> paramiko==2.11.0
> parso==0.8.3
> pathspec==0.10.1
> pbr==5.9.0
> pexpect==4.8.0
> pickleshare==0.7.5
> Pillow==9.0.1
> pipreqs==0.4.11
> platformdirs==2.5.2
> plotly==5.9.0
> pprintpp==0.4.0
> prettytable==3.3.0
> prometheus-client==0.14.1
> prometheus-flask-exporter==0.20.2
> prompt-toolkit==3.0.28
> protobuf==3.19.4
> psutil==5.9.1
> ptyprocess==0.7.0
> pure-eval==0.2.2
> pycodestyle==2.8.0
> pycparser==2.21
> pyexcel==0.7.0
> pyexcel-cli==0.0.3
> pyexcel-io==0.6.6
> pyexcel-xlsx==0.6.0
> Pygments==2.11.2
> PyJWT==1.7.1
> PyMySQL==1.0.2
> PyNaCl==1.5.0
> pyparsing==3.0.9
> PyPDF2==1.26.0
> pyperclip==1.8.2
> pyquery==1.4.3
> pyrsistent==0.18.1
> python-dateutil==2.8.2
> python-dotenv==0.20.0
> python-editor==1.0.4
> python-slugify==6.1.2
> python3-openid==3.2.0
> pytz==2021.3
> pyxlsb==1.0.10
> PyYAML==5.4.1
> pyzmq==22.3.0
> querystring-parser==1.2.4
> reportlab==3.6.7
> requests==2.31.0
> requests-oauthlib==1.3.1
> scikit-learn==1.0.2
> scipy==1.8.1
> semantic-version==2.8.5
> sentry-sdk==1.24.0
> six==1.16.0
> smmap==5.0.0
> SQLAlchemy==1.4.37
> sqlparse==0.4.2
> stack-data==0.2.0
> stevedore==3.5.0
> tabulate==0.8.9
> tenacity==8.2.3
> termcolor==1.1.0
> text-unidecode==1.3
> texttable==1.6.4
> threadpoolctl==3.1.0
> tini==3.0.1
> toml==0.10.2
> tornado==6.1
> tqdm==4.64.0
> traitlets==5.1.1
> typing_extensions==4.2.0
> urllib3==1.26.9
> uWSGI==2.0.20
> virtualenv==20.14.1
> wcwidth==0.1.9
> webencodings==0.5.1
> websocket-client==0.59.0
> Werkzeug==2.1.2
> wheezy.core==3.0.1
> xgboost==1.6.1
> xlrd==2.0.1
> yarg==0.1.9
> zipp==3.8.0
> 

我想使用 mysql 作为我的数据库引擎。所以,我尝试用 yum 包来做到这一点。在 .ebextensions 文件夹内的 django.config 文件中,我编写了以下配置:

# .ebextensions/01_django.config

option_settings:
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: "myophio.settings.dev"
    PYTHONPATH: "/var/app/current:$PYTHONPATH"
  aws:elasticbeanstalk:container:python:
    WSGIPath: "myophio.wsgi:application"

packages:
    yum:
      MySQL-python: []
      mariadb-devel: []

container_commands:
  01_migrate:
    command: "source /var/app/venv/*/bin/activate && python3 manage.py migrate"
    command: "python3 manage.py collectstatic --noinput"
    leader_only: true
amazon-web-services amazon-elastic-beanstalk amazon-rds
1个回答
0
投票

你必须删除'mysql==0.0.3'

© www.soinside.com 2019 - 2024. All rights reserved.