Wooyoung Tyler Kim
Wooyoung Tyler Kim

Reputation: 703

AWS ElasticBeanstalk amazon linux pg_config error with psycopg2

I am testing AWS for launching web service. I stuck with pg_config. Error log is

/app/requirements.txt (line 1))
Using cached psycopg2-2.6.2.tar.gz
  Complete output from command python setup.py egg_info:
  running egg_info
  creating pip-egg-info/psycopg2.egg-info
  writing pip-egg-info/psycopg2.egg-info/PKG-INFO
  writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
  writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
  writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
  warning: manifest_maker: standard file '-c' not found

  Error: pg_config executable not found.

  Please add the directory containing pg_config to the PATH
  or specify the full executable path with the option:

      python setup.py build_ext --pg-config /path/to/pg_config build ...

  or with the pg_config option in 'setup.cfg'.

There are many solutions in stackoverflow, but it doesn't work for me.

  packages:
  yum:
    python-devel: []
    postgresql95-devel: []
    libjpeg-devel: '6b'

container_commands:
  01_migrate:
    command: "python manage.py migrate"
  02_collectstatic:
    command: "python manage.py collectstatic --noinput"
  03_createsu:
    command: "python manage.py createsu"
    leader_only: true

option_settings:
  "aws:elasticbeanstalk:application:environment":
    DJANGO_SETTINGS_MODULE: "onreview.settings"
    PYTHONPATH: "$PYTHONPATH"
  "aws:elasticbeanstalk:container:python":
    WSGIPath: "onreview/wsgi.py"

This is my .ebextensions/python.config files contents. And I'm uploading through zipping my source code.

I changed postgresql95-devel to postgresql-devel, 93, 94, all of it. And I use 9.5 version db right now.

I think --pg-config's path is problem. but I can't change it.

Is there any solution??

p.s I do not want to setup inside the EC2 instance through SSH or something.

Upvotes: 2

Views: 2091

Answers (1)

Anthony Manning-Franklin
Anthony Manning-Franklin

Reputation: 5008

You have a syntax error in your original post, packages: should not be indented. I don't know why you have python-devel when python is included in the install, so I can't say that it isn't interfering. Likewise with the line setting the python path.

packages:
  yum:
    python-devel: []
    postgresql95-devel: []
    libjpeg-devel: '6b'

container_commands:
  01_migrate:
    command: "python manage.py migrate"
  02_collectstatic:
    command: "python manage.py collectstatic --noinput"
  03_createsu:
    command: "python manage.py createsu"
    leader_only: true

option_settings:
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: "onreview.settings"
    PYTHONPATH: "$PYTHONPATH"
  aws:elasticbeanstalk:container:python:
    WSGIPath: "onreview/wsgi.py"

Upvotes: 2

Related Questions