0

I have a ubuntu LTS server. On boot I run a script which does the following:

#!/bin/bash
apt-get -y install build-essential python-dev libxml2-dev libxslt1-dev
apt-get -y install python-pip python-virtualenv                                      
mkdir /etc/test/venv
virtualenv /etc/test/venv
. /etc/test/venv/bin/activate
pip install -r /etc/test/requirements.txt
cd /etc/test/utilities/                             
chmod +x worker.py                                     
./worker.py &                                          
exit 0

I know that this executes ok. In my requirements.txt I have the following:

boto
scrapy

Then in my worker.py it starts with this code:

#!/usr/bin/env python
import logging
import boto.swf.layer2 as swf

The error I get is:

Import Error: No module named boto.swf.layer2

I don't know where to start understanding what is going wrong. Is it a path error, or is boto not being installed correctly?

2

You probably have an old version of boto pre-installed on your AMI that doesn't have SWF Layer 2 support yet.

Check by typing this into a shell:

python -c "import boto; print boto.Version"

I think SWF Layer 2 was added in release 2.7, anything before that won't work. Here's the commit adding Layer2 to SWF

Your easiest option is to add -U to your pip command so it updates your packages if they're already installed:

pip install -U -r /etc/test/requirements.txt
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.