1

我試圖在彈性beanstalk實例上安裝peewee軟件包來控制瓶子的應用。我認爲問題在於MySQL-python依賴,但是peewee也不加載。我要求的文件是這樣的:讓peewee在彈性豆杆上工作

bottle==0.11.6 
peewee==2.1.1 
MySQL-python 

我也試過MySQL-pythonMySQL-python==1.2.4b4。由於多種原因,我認爲總結了here,這是行不通的; peewee沒有安裝,我在日誌中得到這個錯誤信息:

2013-05-18 06:57:08,407 [INFO] (15947 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Script succeeded. 
2013-05-18 06:57:08,408 [INFO] (15947 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Executing script: /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py 
2013-05-18 06:57:18,663 [INFO] (15947 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Output from script: New python executable in /opt/python/run/venv/bin/python2.6 
Not overwriting existing python script /opt/python/run/venv/bin/python (you must use /opt/python/run/venv/bin/python2.6) 
Installing distribute..................................................................................................................................................................................................done. 
Installing pip................done. 
Requirement already satisfied (use --upgrade to upgrade): bottle==0.11.6 in /opt/python/run/venv/lib/python2.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 1)) 
Downloading/unpacking peewee==2.1.1 (from -r /opt/python/ondeck/app/requirements.txt (line 2)) 
    Running setup.py egg_info for package peewee 
Downloading/unpacking MySQL-python (from -r /opt/python/ondeck/app/requirements.txt (line 3)) 
    Running setup.py egg_info for package MySQL-python 
    The required version of distribute (>=0.6.28) is not available, 
    and can't be installed while this script is running. Please 
    install a more recent version first, using 
    'easy_install -U distribute'. 

    (Currently using distribute 0.6.27 (/opt/python/run/venv/lib/python2.6/site-packages/distribute-0.6.27-py2.6.egg)) 
    Complete output from command python setup.py egg_info: 
    The required version of distribute (>=0.6.28) is not available, 

and can't be installed while this script is running. Please 

install a more recent version first, using 

'easy_install -U distribute'. 

所以pip不適用於這些軟件包。我非常肯定我可以通過連接到EC2實例並在沒有pip的情況下安裝MySQL-python來解決這個問題,但是在我看來,這將破壞彈性beanstalk的目的,因爲每次啓動新實例時都需要我去並手動修改它。有沒有適合我解決這個問題的方法?我也有同樣的問題,試圖安裝像scipy和matplotlib的東西,廣泛地說,有沒有辦法可以在沒有pip的情況下在彈性beanstalk實例上安裝python包,並且不需要單獨進入每個實例?我應該研究如何製作自定義AMI並將其用於豆莖? 非常感謝, 亞歷克斯

+0

你嘗試運行:「的easy_install -U分發」 – coleifer

回答

0

對不起,我忘了我問了這個。 我最終通過ssh'ing解決了這個問題,並使用easy_install代替pip來安裝MySQL-Python。

基本上我去了蟒蛇虛擬環境方向:

opt/python/run/venv/bin

並安裝版本1.2.3使用的easy_install:

sudo ./easy_install MySQL-Python==1.2.3

我檢查,看它是由安裝試圖在虛擬環境的python中導入MySQLdb:

./python 

>>>import MySQLdb 
>>> 

它適用於我。然後,我通過與彈性魔豆命令行工具再次推到它重置服務器:

git aws.push

,這就是它。有些惱人的必須這樣做,但似乎在新實例啓動時繼續工作。

謝謝, 亞歷克斯

+0

,在一個單一實例環境中工作,但對於自動縮放?我遇到了同樣的問題,但尋找更好的解決方案... – jamstooks

+0

對不起,不確定。有時我的實例重置,我不得不ssh並再次修復它。如果您找到更好的解決方案,我會非常感興趣。 –

+0

這個問題與Python 2.6有關嗎? Python 2.7顯然現在可用作股票AMI。 –