18

i'm trying to follow the tutorial: deploy django on aws Elastic Beanstalk

when i'm doing the Step 6's substep 5:

git aws.push

I get a ImportError message:

(tryhasinenv)Lee-Jamess-MacBook-Pro:tryhasin h0925473$ git aws.push
Traceback (most recent call last):
  File ".git/AWSDevTools/aws.elasticbeanstalk.push", line 21, in <module>
    from aws.dev_tools import * 
  File "/Users/h0925473/tryhasin_root/tryhasin/.git/AWSDevTools/aws/dev_tools.py", line 5, in <module>
    import boto
ImportError: No module named boto

I have no idea what to do. Can somebody tell me what's wrong?

user2988464
  • 3,251
  • 6
  • 21
  • 25
  • I had the same issue and fixed it with this: http://stackoverflow.com/questions/23354411/awss-elastic-beanstalk-not-using-my-virtualenv-no-module-named-boto/27308707#27308707 – Gabriel Dec 05 '14 at 17:06

6 Answers6

42

On OSX I found that pip install boto did not resolve the issue. The problem was that python was not pointing to the pip installation. export PYTHONPATH=/usr/local/lib/python2.7/site-packages resolved this for me.

Jaime Fournier
  • 436
  • 4
  • 2
  • I issued the export for PYTHONPATH but I still get the dreaded boto error when trying to aws.push. When I do go ahead and try to do the pip install boto I get: `File "/usr/local/bin/pip", line 5, in from pkg_resources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in ... raise DistributionNotFound(req) # XXX put more info here pkg_resources.DistributionNotFound: pip==1.1` – Dave Munger May 14 '14 at 01:43
  • 1
    Okay, I fixed this by cloning boto from git and installing that way. – Dave Munger May 14 '14 at 02:07
  • Adding PYTHONPATH also worked for me - I just had to make sure that I was using the right path for the tutorial (e.g. on a mac, after following all the tutorial instructions, the path was /private/tmp/djangodev/lib/python2.7/site-packages). – AndraD Jun 21 '14 at 19:30
  • Hi, everytime I use aws.push I have to re-enter the export path. is there someway around this please? cheers – Phil Hudson Jul 08 '14 at 10:45
  • My Mac OS X install did not come with pip. I found pip in `/usr/local/aws/bin/`. So I ran `pip install boto` from there. `git aws.push` still didn't work. I did a `which python` and saw it wasn't using the python in `/usr/local/aws/bin`. So I added `/usr/local/aws/bin` to my PATH in my ~/.bash_profile. git aws.push is working now with AWS-ElasticBeanstalk-CLI-2.6.3. – shs Sep 04 '14 at 17:10
  • @PhilHudson - Note that you can set the variable globally (at least for your user account) by adding it to your `~/.bash_profile`; every time Terminal is opened, it reads that file. – geerlingguy Aug 16 '17 at 13:41
17

I solved this separately by running:

$ sudo easy_install pip

This uses the default python package installer to install PIP

$ sudo pip install boto 

I needed Admin rights to add boto (I don't know if thats right or not).

Then ran $ eb start

Neeme Praks
  • 8,956
  • 5
  • 47
  • 47
Andy Jarrett
  • 863
  • 2
  • 9
  • 26
4

Did you pip freeze > requirements.txt after you ran pip install boto?

You need to update your requirements.txt after each time you install a new python package locally to ensure your AWS instance has all the required packages as well.

EDIT:

In case you aren't the one who wrote boto in, you'll need to install it and then pip freeze it yourself.

Try running the following commands:

pip install boto
pip freeze > requirements.txt
git add .
git commit -m "Added boto"
git aws.push
Alex
  • 8,321
  • 1
  • 34
  • 30
  • it's because didn't install boto. After I installed boto,git add, git commit and git aws.push, and eb status --verbose is green and ready, but I can still go to the EB default welcome page. It should go to django's welcome page instead. And i've set all the config and edit the setting.py according to the tutorial – user2988464 Apr 25 '14 at 16:09
  • yes, i ran them all. What information should i provide, so it can help you understand what i did wrong? – user2988464 Apr 25 '14 at 16:13
  • i don't get the boto error, but can't go to django's welcome page, it keeps go to eb's welcome page instead – user2988464 Apr 25 '14 at 16:21
  • Are you able to see the Django welcome page on your local computer? i.e. after you run `python manage.py runserver`? Did you do `django-admin.py startproject mysite` and all of that? – Alex Apr 25 '14 at 16:28
  • i can't run python manage.py runserver, the message is "Unknown command: 'runserver'", but i'm sure i'm at the level of manage.py. and i did django-admin.py startproject mysite before i set eb – user2988464 Apr 25 '14 at 16:38
  • Run 'python manage.py help' and see what exception you're getting. – Alex Apr 25 '14 at 16:40
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/51451/discussion-between-user2988464-and-alex) – user2988464 Apr 25 '14 at 16:43
  • I am getting the same "no module named boto" error. I ran all of these commands and can see boto saved in my requirements file, which was successfully committed, but I'm still getting the error. What else can I do? – Michelle Glauser Apr 29 '14 at 01:40
2

I had a similar issue with Ansible and fixed it using:

sudo apt install python-boto
Falko Menge
  • 788
  • 7
  • 16
0

I am using python3. So I had to use the following command for PYTHONPATH to point to site-packages dir

export PYTHONPATH=/usr/local/lib/python3.8/site-packages
and_roid
  • 1
  • 1
0

If you're using ubuntu, try this out:-

sudo apt install python-boto3

Should work.

Vinu Joseph
  • 965
  • 9
  • 11