【发布时间】:2015-03-21 21:36:41
【问题描述】:
我在 AWS Elastic Beanstalk 上部署 matplotlib 非常开心。 I gather 我的问题来自某些依赖项以及 EB 部署使用 PIP 安装的软件包的方式,并已尝试按照 instructions here on SO 解决问题。
我首先尝试按照链接答案中的建议逐步部署,方法是将 matplotlib 包堆栈的各个部分分阶段添加到我的 requirements.txt 文件中。但这需要 forever(对于每个阶段)并且容易出现故障和超时(这似乎会使构建目录落后于后续的软件包安装)。
所以答案末尾随便提到的简单解决方案对我很有吸引力:只需eb ssh,使用
source /opt/python/run/venv/bin/activate
和pip install 手动打包。但我也不能让它工作。首先,我经常遇到左侧构建目录(如上所述)
pip can't proceed with requirement 'xxxx' due to a pre-existing build directory.
location: /opt/python/run/venv/build/xxxx
This is likely due to a previous installation that failed.
pip is being responsible and not assuming it can delete this.
Please delete it and try again.
但即使在删除这些之后,我也一直得到 p>
Exception:
Traceback (most recent call last):
File "/opt/python/run/venv/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/opt/python/run/venv/lib/python2.7/site-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/opt/python/run/venv/lib/python2.7/site-packages/pip/req.py", line 1197, in prepare_files
do_download,
File "/opt/python/run/venv/lib/python2.7/site-packages/pip/req.py", line 1375, in unpack_url
self.session,
File "/opt/python/run/venv/lib/python2.7/site-packages/pip/download.py", line 582, in unpack_http_url
unpack_file(temp_location, location, content_type, link)
File "/opt/python/run/venv/lib/python2.7/site-packages/pip/util.py", line 625, in unpack_file
untar_file(filename, location)
File "/opt/python/run/venv/lib/python2.7/site-packages/pip/util.py", line 533, in untar_file
os.makedirs(location)
File "/opt/python/run/venv/lib64/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/opt/python/run/venv/build/xxxx'
响应pip install xxxx(并且sudo pip 失败并返回sudo: pip: command not found)。
我可以做些什么来让它在 AWS-EB 上运行?特别是,我需要做什么才能使简单的 SSH+PIP 方法正常工作;还是有其他更好的——更简单的! — 我应该尝试的方法。
FWIW,我有一个 .ebextensions/software.config 和
packages:
yum:
gcc-c++: []
gcc-gfortran: []
python-devel: []
atlas-sse3-devel: []
lapack-devel: []
libpng-devel: []
freetype-devel: []
zlib-devel: []
还有一个以
结尾的requirements.txt
pytz==2014.10
pyparsing==2.0.3
python-dateutil==2.4.0
nose==1.3.4
six>=1.8.0
mock==1.0.1
numpy==1.9.1
matplotlib==1.4.2
大约 4 小时后,我已经达到了 numpy 的程度(由 EB virtualenv 中的pip list 报告)。
并且(如果重要的话)进行 SSH 的用户属于具有策略的组
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"elasticbeanstalk:*",
"ec2:*",
"elasticloadbalancing:*",
"autoscaling:*",
"cloudwatch:*",
"s3:*",
"sns:*",
"cloudformation:*",
"rds:*",
"sqs:*",
"iam:PassRole"
],
"Resource": "*"
}
]
}
【问题讨论】:
标签: numpy amazon-web-services matplotlib pip amazon-elastic-beanstalk