【问题标题】:install gdal on eb create/deploy failing在 eb 创建/部署失败时安装 gdal
【发布时间】:2017-02-01 16:01:46
【问题描述】:

我正在尝试通过 AWS EB 启动我的 Django 应用程序,但是当我按照教程http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html 中显示的步骤操作时,它一直给我一个错误消息,提示“您的 requirements.txt 无效”。我想我在尝试安装我在 requirements.txt 上的 GDAL 2.1.0 时遇到了错误

这是我的一些配置文件:

project.config

option_settings:
    "aws:elasticbeanstalk:application:environment":
        DJANGO_SETTINGS_MODULE: "hungryboat.settings"
        PYTHONPATH: "/opt/python/current/app/src:$PYTHONPATH"
    "aws:elasticbeanstalk:container:python":
        WSGIPath: "hungryboat/wsgi.py"
command:
    01_pip_update:
        command:"pip install --upgrade pip"

packages.config

packages:
    yum:
        git: []
        libtiff-devel: []
        libjpeg-turbo-devel: []
        libzip-devel: []
        freetype-devel: []
        postgresql95-devel: []
        geos: []
        libmemcached: []
        libmemcached-devel: []
        cyrus-sasl-devel: []
        zlib-devel: []
command:
    01_gdal:
        command:"yum --enablerepo=epel -y install gdal"

以及我得到的错误消息/日志:

  Traceback (most recent call last):
    File "/tmp/pip-build-zju5440p/GDAL/setup.py", line 118, in fetch_config
      p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
    File "/usr/lib64/python3.4/subprocess.py", line 859, in __init__
      restore_signals, start_new_session)
    File "/usr/lib64/python3.4/subprocess.py", line 1457, in _execute_child
      raise child_exception_type(errno_num, err_msg)
  FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/tmp/pip-build-zju5440p/GDAL/setup.py", line 166, in get_gdal_config
      return fetch_config(option, gdal_config = self.gdal_config)
    File "/tmp/pip-build-zju5440p/GDAL/setup.py", line 122, in fetch_config
      raise gdal_config_error(e)
  __main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/tmp/pip-build-zju5440p/GDAL/setup.py", line 118, in fetch_config
      p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
    File "/usr/lib64/python3.4/subprocess.py", line 859, in __init__
      restore_signals, start_new_session)
    File "/usr/lib64/python3.4/subprocess.py", line 1457, in _execute_child
      raise child_exception_type(errno_num, err_msg)
  FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "<string>", line 20, in <module>
    File "/tmp/pip-build-zju5440p/GDAL/setup.py", line 320, in <module>
      **extra )
    File "/usr/lib64/python3.4/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib64/python3.4/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib64/python3.4/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "<string>", line 15, in replacement_run
    File "/opt/python/run/venv/local/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 207, in find_sources
      mm.run()
    File "/opt/python/run/venv/local/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 291, in run
      self.add_defaults()
    File "/opt/python/run/venv/local/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 320, in add_defaults
      sdist.add_defaults(self)
    File "/opt/python/run/venv/local/lib/python3.4/site-packages/setuptools/command/sdist.py", line 130, in add_defaults
      build_ext = self.get_finalized_command('build_ext')
    File "/usr/lib64/python3.4/distutils/cmd.py", line 299, in get_finalized_command
      cmd_obj.ensure_finalized()
    File "/usr/lib64/python3.4/distutils/cmd.py", line 107, in ensure_finalized
      self.finalize_options()
    File "/tmp/pip-build-zju5440p/GDAL/setup.py", line 195, in finalize_options
      self.gdaldir = self.get_gdal_config('prefix')
    File "/tmp/pip-build-zju5440p/GDAL/setup.py", line 175, in get_gdal_config
      return fetch_config(option)
    File "/tmp/pip-build-zju5440p/GDAL/setup.py", line 122, in fetch_config
      raise gdal_config_error(e)
  __main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'

  ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-zju5440p/GDAL
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
2017-02-01 06:13:28,277 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 541, 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)

欢迎任何有关如何解决此问题的建议。

仅供参考:我已经尝试过 radtek 在这篇文章中的回答 - Configuring Amazon Elastic Beanstalk with PostGIS 没有运气。还尝试了与他的答案类似的其他人。

谢谢。

【问题讨论】:

    标签: django amazon-web-services gdal


    【解决方案1】:

    可能是因为缺少开发包。所以你可以尝试像这样安装'gdal-dev'

    yum --enablerepo=epel -y install gdal gdal-devel
    

    【讨论】:

      【解决方案2】:

      我通过在 package.config 文件上创建一个巨大的命令解决了这个问题

      我添加了这一行:

      commands:
          01_gdal:
              command: "wget http://download.osgeo.org/gdal/2.1.3/gdal-2.1.3.tar.gz && tar -xzf gdal-2.1.3.tar.gz && cd gdal-2.1.3 && ./configure && make && make install"
      

      从此 pip install GDAL 完美运行。如果有人卡住了,希望这会有所帮助。免责声明:使用不同环境/设置/等的人可能会有所不同。

      【讨论】:

      • 这项工作可能需要 20-30 分钟来编译 gdal。一种选择是从 Beanstalk 使用的 AMI 启动一个 EC2 实例,按照您的说明进行设置,然后为其创建一个新的 AMI,并将 beanstalk AMI id 更新为刚刚创建的那个。在这里详细解释:blog.maddevs.io/…
      猜你喜欢
      • 1970-01-01
      • 2020-11-02
      • 2018-03-20
      • 2019-05-18
      • 1970-01-01
      • 2020-11-02
      • 1970-01-01
      • 1970-01-01
      • 2018-12-26
      相关资源
      最近更新 更多