Wie kann ich matplotlib für meine AWS Elastic Beanstalk-Anwendung installieren?
Ich habe verdammt viel Zeit mit der Bereitstellung von matplotlib auf AWS Elastic Beanstalk.Ich samml dass mein Problem von einigen Abhängigkeiten und der Art und Weise herrührt, wie EB mit PIP installierte Pakete bereitstellt, und versucht hat, dem @ zu folgAnweisungen hier auf SO zur Behebung des Problems.
Ich habe zuerst versucht, wie in der verknüpften Antwort vorgeschlagen, inkrementell bereitzustellen, indem ich Teile des matplotlib-Paketstapels zu meinem @ hinzugefügt habrequirements.txt
Datei in Stufen. Aber das brauchtfür imme (für jede Phase) und ist anfällig für Fehler und Zeitüberschreitungen (wodurch Build-Verzeichnisse zurückbleiben und nachfolgende Paketinstallationen blockieren).
So appelliert die einfache Lösung, die am Ende der Antwort beiläufig erwähnt wird, an mich: justeb ssh
, aktiviere das virtialenv mit
source /opt/python/run/venv/bin/activate
undpip install
Pakete manuell. Aber ich kann das auch nicht zum Laufen bringen. Zuerst bin ich oft mit linksbindenden Build-Verzeichnissen konfrontiert (wie oben erwähnt)
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.
Aber auch nach dem Entfernen dieser bekomme ich konsequent
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'
als Antwort aufpip install xxxx
(undsudo pip
schlägt fehl mitsudo: pip: command not found
).
Was kann ich tun, um dies auf AWS-EB zum Laufen zu bringen? Was muss ich insbesondere tun, damit der einfache SSH + PIP-Ansatz funktioniert? oder gibt es eine andere besser - einfacher! - Ansatz sollte ich versuchen.
FWIW, ich habe ein.ebextensions/software.config
mit
packages:
yum:
gcc-c++: []
gcc-gfortran: []
python-devel: []
atlas-sse3-devel: []
lapack-devel: []
libpng-devel: []
freetype-devel: []
zlib-devel: []
und einrequirements.txt
das endet mit
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
Nach ca. 4 Stunden bin ich schon ziemlich benommen (wie von @ gemeldetpip list
in der EB virtualenv).
Und (falls es darauf ankommt) der Benutzer, der SSHing ist, ist Teil einer Gruppe mit der Richtlinie
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"elasticbeanstalk:*",
"ec2:*",
"elasticloadbalancing:*",
"autoscaling:*",
"cloudwatch:*",
"s3:*",
"sns:*",
"cloudformation:*",
"rds:*",
"sqs:*",
"iam:PassRole"
],
"Resource": "*"
}
]
}