0

私はPythonライブラリPyDDEを使ってFlask Webサービスを持っていますが、これはPyPI上に配布されていますが、何らかの形でピピインストールすることはできません。私はpip install git+https://github.com/hensing/PyDDE.gitを使ってこのライブラリをローカル環境にインストールするか、クローンしてsetup.pyをインストールします。AWS Elastic BeanstalkまたはGoogle App EngineにpipをインストールしていないPythonライブラリを使用するにはどうすればよいですか?

AWS Elastic BeanstalkまたはGoogle App Engine Flexible Environmentのいずれかでプロジェクトをアップロードしてビルドしようとすると、このライブラリの一致するディストリビューションが見つからないという問題が発生します。

この問題を解決するための回避策はありますか?ここで

はGAE柔軟からのエラーメッセージです:

Step #1: Could not find a version that satisfies the requirement PyDDE (from -r requirements.txt (li 
ne 7)) (from versions:) 
Step #1: No matching distribution found for PyDDE (from -r requirements.txt (line 7)) 
Step #1: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1 
Finished Step #1 
ERROR 
ERROR: build step "gcr.io/cloud-builders/[email protected]:331786b295647a4560ed004a46761ee91409e754df7ffa7 
54a67000bd020729a" failed: exit status 1 
Step #1: 
------------------------------------------------------------------------------------------------------ 

ERROR: (gcloud.app.deploy) Cloud build failed. Check logs at https://console.cloud.google.com/gcr/buil 
ds/6ace1019-8bf5-434b-b916-5c6cae84de9f?project=project-190120 Failure status: UNKNOWN: Err 
or Response: [2] Build failed; check build logs for details 

そして、ここでは私のrequirements.txtです:

Flask==0.12.2 
Werkzeug==0.12.2 
gunicorn==19.7.1 
pandas>0.20.0 
numpy>1.13.0 
scipy>0.19.0 
PyDDE 
google-api-python-client 

UPDATE:

私はrequirements.txtにこの行を追加:

-e git+git://github.com/hensing/PyDDE.git#egg=PyDDE 

これはGAEで動作します。

ありがとう@hansaplast!

ただし、AWS Elastic Beanstalkはこれを受け付けませんrequirements.txt。これは、このエラーがスローされます。

INFO: Created CloudWatch alarm named: awseb-e-3tu2ajdxug-stack-AWSEBCloudwatchAlarmLow-8NOPISSRAAEH 
ERROR: Your requirements.txt is invalid. Snapshot your logs for details. 
ERROR: [Instance: i-03e92fa3c58b6e010] Command failed on instance. Return code: 1 Output: (TRUNCATED). 
..) 
    File "/usr/lib64/python2.7/subprocess.py", line 541, 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 2. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI. 
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1]. 
ERROR: Create environment operation is complete, but with errors. For more information, see troubleshooting documentation. 
+0

エラーメッセージを共有できますか? – hansaplast

+0

'requirements.txt'の内容をあなたの質問に入れることができますか? – hansaplast

+2

* requirement.txtを使用している場合、[この回答で提案された] requirements.txtに '-e git:// https:// github.com/hensing/PyDDE.git'を追加できますか(https ://stackoverflow.com/a/16584935/119861)? ' – hansaplast

答えて

1

代わりのPyDDE、あなたrequirements.txtにこれを追加します。

-e git://https://github.com/hensing/PyDDE.git#egg=PyDDE 

AWS Elastic Beanstalk doesn't accept this requirements.txt

あなたのrequirements.txtにgit+git://github.com/hensing/PyDDE.git#egg=PyDDEを入れているようです。上記のようにgit+#egg=PyDDEをファイルから削除してください。

+0

GAEはこの部分に '#egg = PyDDE'を必要とするようですが、そうでなければ無効です。 –

1
  • 同じフォルダ内にappengine_config.pyという名前のファイルを作成しますpip install -t <dir>
  • を使用して、そのフォルダの中に、あなたの希望のライブラリをインストールします例えばlib

  • 、プロジェクトフォルダにフォルダを作成します。 app.yamlファイルとして編集し、次のように編集します。

    from google.appengine.ext import vendor 
    vendor.add('lib') # Folder name 
    
  • 展開
+0

はい、私はこの手順に従いました。しかし、それは展開中に 'requirements.txt'に基づいてDockerコンテナ内のすべてのライブラリを構築します。 –

+0

@EvyatarMegedこれは標準的な環境にのみ適用され、柔軟なものには適用されません。 –

関連する問題