让peewee在弹性豆茎上工作

时间:2013-05-18 07:16:37

标签: amazon-web-services mysql-python bottle elastic-beanstalk peewee

我试图在弹性beanstalk实例上安装peewee包以控制瓶子应用程序。我认为问题在于MySQL-python依赖,但是peewee也没有加载。我的需求文件如下所示:

bottle==0.11.6
peewee==2.1.1
MySQL-python

我还尝试MySQL-python作为MySQL-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并在beanstalk上使用它? 非常感谢, 亚历

1 个答案:

答案 0 :(得分:0)

抱歉,我忘了我问过这个问题。 我最终通过ssh进入实例并使用easy_install而不是pip安装MySQL-Python来解决这个问题。

基本上我去了python虚拟环境方向:

opt/python/run/venv/bin

并使用easy_install安装版本1.2.3:

sudo ./easy_install MySQL-Python==1.2.3

我通过尝试在虚拟环境的python中导入MySQLdb来检查它是否已安装:

./python

>>>import MySQLdb
>>>

它对我有用。然后我通过弹性beanstalk命令行工具再次推送它来重置服务器:

git aws.push

就是这样。有点烦人,但是在新实例启动时它似乎仍然有用。

谢谢, 亚历