I am very new to AWS and in-general coding. I wrote a small Django application, and now I am trying to deploy it on AWS using elastic beanstalk with the help of this URL. https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html
My application uses Postgres database for which I need psycopg2
package, which I have added in my requirements.txt file. (this is not part of the instructions on this URL but I knew I need psycopg2 so I added)
when I create EB environment using eb create django-env
, I get the following error:
This log I took from EC2 /var/log/
.
Here is the error:
[2018-09-26T21:44:20.502Z] INFO [3151] - [Application deployment app-d840-180926_224155@1/StartupStage0/AppDeployPreHo ok/03deploy.py] : Starting activity... [2018-09-26T21:44:21.774Z] INFO [3151] - [Application deployment app-d840-180926_224155@1/StartupStage0/AppDeployPreHo ok/03deploy.py] : Activity execution failed, because: Collecting alabaster==0.7.10 (from -r /opt/python/ondeck/app/requi rements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/2e/c3/9b7dcd8548cf2c00531763ba154e524af575e8f36701bacfe5bcadc674 40/alabaster-0.7.10-py2.py3-none-any.whl Collecting anaconda-client==1.6.9 (from -r /opt/python/ondeck/app/requirements.txt (line 2)) Could not find a version that satisfies the requirement anaconda-client==1.6.9 (from -r /opt/python/ondeck/app/requi rements.txt (line 2)) (from versions: 1.1.1, 1.2.2) No matching distribution found for anaconda-client==1.6.9 (from -r /opt/python/ondeck/app/requirements.txt (line 2)) You are using pip version 9.0.1, however version 18.0 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
2018-09-26 21:44:21,768 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 186, 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)
My settings.py
file of Django project has psycopg2
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'test',
'USER': 'postgres',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '5432',
'TEST': {
'NAME': 'testdb',
},
}
}
[EDIT] My requirements.txt file is:
c:\Users\abhi\OneDrive\Python-Projects\myproject>cat requirements.txt
Django==2.1.1
psycopg2==2.7.5
pytz==2018.5
My question is:
- How to fix this issue?
- Why it is saying that You are using pip version 9.0.1, however, version 18.0 is available? I am using pip 18.0, I am sure.
- Why it says - Collecting anaconda-client==1.6.9 ? I want to install
psycopg2
, notanaconda
.
It is my side project, and I don't know how to fix it.