I'm trying to install the peewee package on an elastic beanstalk instance to control a bottle application. I think the problem is with the MySQL-python dependency, but peewee doesn't load either. My requirements file looks like this:
bottle==0.11.6
peewee==2.1.1
MySQL-python
I also tried MySQL-python
as MySQL-python==1.2.4b4
. For a number of reasons which I believe are summed up here, this doesn't work; peewee isn't installed and I get this error message in the log:
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'.
So pip doesn't work for these packages. I'm pretty sure I could fix this by connecting to the EC2 instance and installing MySQL-python without pip, but it seems to me that would defeat the purpose of elastic beanstalk, since every time a new instance started it would need me to go in and tinker with it manually. Is there a proper way for me to deal with this problem? I've also had the same issue trying to install things like scipy and matplotlib, so broadly, is there a way I can install python packages on elastic beanstalk instances without pip, and without going into each instance individually? Should I be looking into how to make a custom AMI and use it on beanstalk? Thanks a lot, Alex
Sorry I forgot I asked this. I eventually solved this issue by ssh'ing into the instance and installing MySQL-Python using easy_install instead of pip.
Basically I went to the python virtual environment direction at:
opt/python/run/venv/bin
and installed version 1.2.3 using easy_install:
sudo ./easy_install MySQL-Python==1.2.3
I checked to see it was installed by trying to import MySQLdb in the virtual environment's python:
./python
>>>import MySQLdb
>>>
and it worked for me. Then I reset the server by pushing to it again with the elastic beanstalk command line tool:
git aws.push
and that's about it. Somewhat annoying to have to do it, but it seems to continue to work when a new instance is started up.
Thanks, Alex
来源:https://stackoverflow.com/questions/16621726/getting-peewee-to-work-on-elastic-beanstalk