Reputation: 1603
I'm trying to deploy my personal website to aws using elastic beanstalk. My website is in django/python. I keep encountering the same issue. Each time I upload the files I get the following error in AWS console:
Your requirements.txt is invalid. Snapshot your logs for details.
Ok, so I check the logs and from the bits I notice the following:
Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 2Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
install_dependencies()
pip version 7.1.2, however version 9.0.1 is available.You should consider upgrading via the 'pip install --upgrade pip' command.
I googled and found many having this issue. They suggested updating pip and installing dependencies manually. So I logged into the server and started by updating pip. Boom, another issue. After updating to pip 9.0.1 when I type pip --version I get the following:
-bash: /usr/bin/pip: no such file or directory
I can't seem to move on with this. I thought elastic beanstalk is supposed to be easy but I keep getting more and more stuff to do. I'm at my wits end after all the testing today. Could I ask for any help with this? What should I do next? I suppose AWS don't provide support for stuff like that, do they? Thanks.
Edit. I am using python 3.6 and django 1.11.4.
Edit 2: Added requirements.txt and 01_packages.config and django.config
Here's the requirements.txt:
altgraph==0.14
argon2-cffi==16.3.0
awsebcli==3.12.0
botocore==1.7.36
cement==2.8.2
cffi==1.10.0
colorama==0.3.7
cx-Freeze==5.0.2
Django==1.11.4
django-bootstrap3==9.0.0
django-braces==1.11.0
dnspython==1.15.0
docker-py==1.7.2
dockerpty==0.4.1
docopt==0.6.2
docutils==0.14
et-xmlfile==1.0.1
future==0.16.0
idna==2.6
jdcal==1.3
jmespath==0.9.3
macholib==1.8
olefile==0.44
pathspec==0.5.0
pefile==2017.9.3
Pillow==4.2.1
python-dateutil==2.6.1
pytz==2017.2
PyYAML==3.12
requests==2.9.1
semantic-version==2.5.0
six==1.10.0
tabulate==0.7.5
termcolor==1.1.0
untangle==1.1.1
virtualenv==15.1.0
websocket-client==0.44.0
Here's 01_packages.config file:
packages:
yum:
altgraph: []
argon2-cffi: []
awsebcli: []
botocore: []
cement: []
cffi: []
colorama: []
Django: []
django-bootstrap3: []
django-braces: []
dnspython: []
dockerpty: []
docopt: []
future: []
idna: []
macholib: []
pathspec: []
Pillow: []
python-dateutil: []
PyYAML: []
untangle: []
And here's django.config:
option_settings:
"aws:elasticbeanstalk:container:python":
WSGIPath: "davidbiendotcom/wsgi.py"
Upvotes: 1
Views: 440
Reputation: 172
Two things to check.
Firstly, before running pip you need to get in the right virtual environment by typing:
source /opt/python/run/venv/bin/activate
source /opt/python/current/env
Secondly, please check that you are running the commands in the right section of your ebextensions file. If you look here you can see an explanation of the different command sections in a problem I previously had. If you need to upgrade pip it needs to be done in the container_commands section.
Reviewing your attachments above I think you are trying to install too much using yum.
I would suggest a django config like this:
option_settings:
packages:
yum:
mysql-devel: []
gcc: []
make: []
gcc-c++: []
libjpeg-turbo-devel: []
python26-devel: []
postgresql94-devel: []
libcurl-devel: []
container_commands:
01_collectstatic:
command: "django-admin.py generate_favicon static/img/email_logo.png"
command: "find /opt/python/current/app/static -mmin -1440 | xargs touch"
command: "django-admin.py collectstatic --noinput --clear"
03_migrate:
command: "django-admin.py migrate --noinput"
leader_only: true
04_wsgipass:
command: 'echo "WSGIPassAuthorization On" >> ../wsgi.conf'
And the other packages should install automatically using pip.
If you still have a problem with the pip version then you might need to install your other packages using requirements.txt then upgrade pip and install your final package using an additional container command.
If you're still struggling please post your ebextensions file and your requirements.txt
Upvotes: 2