Django приложение, использующее matlab.engine в python сценарии, завершается неудачно при развертывании на aws с использованием elasti c beanstalk - PullRequest
0 голосов
/ 08 марта 2020

Я развертываю свое приложение django на aws, используя elasti c beanstalk. Я настроил виртуальную python среду и ее использование matlab.engine внутри python скрипта. Он отлично работает на моем ec2, но когда я использую eb deploy coomand, он показывает ошибку ниже. Я поместил журналы ошибок ниже.

[2020-03-07T18:51:26.604Z] INFO  [10873] - [Application update app-200307_185106@172/AppDeployStage0/AppDeployPreHook/03deploy.py] : Starting activity...
[2020-03-07T18:51:27.509Z] INFO  [10873] - [Application update app-200307_185106@172/AppDeployStage0/AppDeployPreHook/03deploy.py] : Activity execution failed, because: Requirement already satisfied: certifi==2019.11.28 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 1))
  Requirement already satisfied: chardet==3.0.4 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 2))
  Requirement already satisfied: defusedxml==0.6.0 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 3))
  Requirement already satisfied: Django==2.1.1 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 4))
  Requirement already satisfied: django-paypal==1.0.0 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 5))
  Requirement already satisfied: idna==2.8 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 6))
  Collecting matlabengineforpython===R2018b (from -r /opt/python/ondeck/app/requirements.txt (line 7))
    Could not find a version that satisfies the requirement matlabengineforpython===R2018b (from -r /opt/python/ondeck/app/requirements.txt (line 7)) (from versions: )
  No matching distribution found for matlabengineforpython===R2018b (from -r /opt/python/ondeck/app/requirements.txt (line 7))
  You are using pip version 9.0.1, however version 20.0.2 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
  2020-03-07 18:51:27,502 ERROR    Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
  Traceback (most recent call last):
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
      install_dependencies()
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
      check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
    File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
      raise CalledProcessError(retcode, cmd)
  CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 (ElasticBeanstalk::ExternalInvocationError)
caused by: Requirement already satisfied: certifi==2019.11.28 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 1))
  Requirement already satisfied: chardet==3.0.4 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 2))
  Requirement already satisfied: defusedxml==0.6.0 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 3))
  Requirement already satisfied: Django==2.1.1 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 4))
  Requirement already satisfied: django-paypal==1.0.0 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 5))
  Requirement already satisfied: idna==2.8 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 6))
  Collecting matlabengineforpython===R2018b (from -r /opt/python/ondeck/app/requirements.txt (line 7))
    Could not find a version that satisfies the requirement matlabengineforpython===R2018b (from -r /opt/python/ondeck/app/requirements.txt (line 7)) (from versions: )
  No matching distribution found for matlabengineforpython===R2018b (from -r /opt/python/ondeck/app/requirements.txt (line 7))
  You are using pip version 9.0.1, however version 20.0.2 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
  2020-03-07 18:51:27,502 ERROR    Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
  Traceback (most recent call last):
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
      install_dependencies()
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
      check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
    File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
      raise CalledProcessError(retcode, cmd)
  CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 (Executor::NonZeroExitStatus)


[2020-03-07T18:51:27.509Z] INFO  [10873] - [Application update app-200307_185106@172/AppDeployStage0/AppDeployPreHook/03deploy.py] : Activity failed.
[2020-03-07T18:51:27.510Z] INFO  [10873] - [Application update app-200307_185106@172/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2020-03-07T18:51:27.510Z] INFO  [10873] - [Application update app-200307_185106@172/AppDeployStage0] : Activity failed.
[2020-03-07T18:51:27.510Z] INFO  [10873] - [Application update app-200307_185106@172] : Completed activity. Result:
  Application update - Command CMD-AppDeploy failed

Установленные пути:

matlab:

/ usr / local / MATLAB / R2018b / bin

virual окружение:

/ home / ec2-user / eb-virt (virtual env) / bin /

Я полагаю, что eb deploy ищет требования matlab на каком-то другом пути. Пожалуйста, предложите мне решение.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...