2015-11-17 10 views
6

私は最初のアプリケーション(Flask)をEBにデプロイしています。 PostgreSQLを使用するには、psycopg2がインストールされている必要がありますが、実行する方法を理解できません。私はpostgresql93-devel: []としてさまざまなバリエーションを試してみた弾力のあるbeanstalkのpsycopg2 - アプリケーションをデプロイできません

packages: 
    yum: 
    postgresql-devel: [] 

は、私は次のコードでファイル名 .elasticbeanstalk/01_packages.configを追加する必要があり、このポスト( Psycopg2 on Amazon Elastic Beanstalk)と同様に、このポスト( https://realpython.com/blog/python/deploying-a-django-app-to-aws-elastic-beanstalk/)で見ましたまだ運がない。以下に私のエラーログを添付します。

[2015-11-16T21:03:24.749Z] INFO [2680] - [Application update/AppDeployStage0/AppDeployPreHook/03deploy.py] : Starting activity... 
[2015-11-16T21:03:27.024Z] INFO [2680] - [Application update/AppDeployStage0/AppDeployPreHook/03deploy.py] : Activity execution failed, because: Collecting psycopg2==2.6.1 (from -r /opt/python/ondeck/app/requirements.txt (line 1)) 
    Using cached psycopg2-2.6.1.tar.gz 
     Complete output from command python setup.py egg_info: 
     running egg_info 
     creating pip-egg-info/psycopg2.egg-info 
     writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt 
     writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt 
     writing pip-egg-info/psycopg2.egg-info/PKG-INFO 
     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'. 

     ---------------------------------------- 
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-z20gvx7_/psycopg2 
    2015-11-16 21:03:27,010 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 540, 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 (ElasticBeanstalk::ExternalInvocationError) 
caused by: Collecting psycopg2==2.6.1 (from -r /opt/python/ondeck/app/requirements.txt (line 1)) 
    Using cached psycopg2-2.6.1.tar.gz 
     Complete output from command python setup.py egg_info: 
     running egg_info 
     creating pip-egg-info/psycopg2.egg-info 
     writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt 
     writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt 
     writing pip-egg-info/psycopg2.egg-info/PKG-INFO 
     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'. 

     ---------------------------------------- 
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-z20gvx7_/psycopg2 
    2015-11-16 21:03:27,010 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 540, 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) 

は、私がpsycopg2がインストールされて取得する必要があることをかなり明確ようだが、私はこの仕事をするために取ることができ、他のどのような手順はよく分かりません。

+0

私は同じです。私はそれを解決すればあなたに知らせます。 – Cephlin

答えて

7

私はあなたが最初にあなたのEC2インスタンスを開く必要があり、それを解決し、その後、この

sudo yum install postgresql-devel 

のようにインストール後でもpostgresql93-develのをインストールした後にEB

+0

はあなたが提供したコマンドの後に 'sudo install psycopg2'を完了することができました! – Vadim

0

を展開、私はありません「というエラーを取得保管psycopg2という名前のモジュールです。これを解決するには、eb sshで自分の環境に接続し、これを解決するためにsudo pip install psycopg2を実行しなければなりませんでした。

関連する問題