21

I'm trying to follow this tutorial: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html

in order to deploy a Ruby on Rails app in AWS with Ubuntu.

Everything went ok (I can run my app in local), until the final step. When I run aws.push I get next error.

   roberto@ubuntu:~/dev/myapp$ git aws.push
Traceback (most recent call last):
  File ".git/AWSDevTools/aws.elasticbeanstalk.push", line 21, in <module>
    from aws.dev_tools import * 
  File "/home/roberto/dev/myapp/.git/AWSDevTools/aws/dev_tools.py", line 5, in <module>
    import boto
ImportError: No module named boto

I have read this post git aws.push: No module named boto and run:

pip install boto
pip freeze > reqIuirements.txt
git add .
git commit -m "Added boto"
git aws.push

But still the same result.

UPDATE: I think the problem is related to my python versions. When I run which python I get /usr/bin/python. If I do ls this folder I see python, python2, python2.7, python3, python3.4.

When I run python I get:

Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

I don't know what to do.

The problem was the first boto installation it didn't work due to permissions problems, and I didn't realize. I ran sudo pip install boto and everything went OK this time.

Community
  • 1
  • 1
Rober
  • 5,868
  • 17
  • 58
  • 110
  • I had the same problem, I fixed it doing this: http://stackoverflow.com/questions/23354411/awss-elastic-beanstalk-not-using-my-virtualenv-no-module-named-boto/27308707#27308707 – Gabriel Dec 05 '14 at 04:25
  • just incase this helps people -- I also used: ```sudo pip install boto``` to install, but the permissions were then wrong - and had to ```chmod 755``` on the installed packages to fix – developer Oct 16 '20 at 09:25

8 Answers8

40

What happened is that the eb command line interface available in that specific AWS tutorial (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html) does not provide the latest version of boto.

When you did

pip install boto

you installed the latest version from https://github.com/boto/boto which solved the issue.

Diego Milán
  • 701
  • 7
  • 10
20

If on OSX w/o pip installed:

sudo easy_install pip
sudo pip install boto
Stone
  • 2,608
  • 26
  • 26
8

Make sure when you install Python modules that you look at the output to verify that the install happened properly. On Mac/Linux I had to run sudo to get boto to install properly.

sudo pip install boto
Michael Connor
  • 4,182
  • 24
  • 21
4

I had face same issue with boto installation on Mac OS High Sierra :

boto required PYTHONPATH to be set in system. First install boto :

sudo pip install boto

After installation it will return path where boto is installed in logs. Use same path to add export as PYTHONPATH

Requirement already satisfied: boto in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2.48.0)

export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages

After adding PYTHONPATH python will able to detect boto module in system.

Sid Mhatre
  • 3,272
  • 1
  • 19
  • 38
  • bingo - may devops no longer be hacky one day - until then, thank goodness for answers which are like cool water upon the head of a mac user – WEBjuju Dec 30 '18 at 04:55
3

If you are still having issues after downloading boto, make sure your script is able to reach your site-packages by defining the PYTHONPATH environment variable.

export PYTHONPATH=/usr/local/lib/python2.7/site-packages
Zoe
  • 27,060
  • 21
  • 118
  • 148
Atakan E.
  • 205
  • 2
  • 6
1

Doing these 3 steps helps in cases there are any error with installing pip/python first.

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py 
$ sudo pip install boto

Or if you are on Mac, then you can try installing Python3.

https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.6.pkg then, Install it (UI way if you want to).

$ sudo pip3 install boto
AKS
  • 16,482
  • 43
  • 166
  • 258
1

Another option is to run:

python -m pip install --user boto

pip defaults to installing Python packages to a system directory (such as /usr/local/lib/python3.X).
This requires root access.

--user makes pip install packages in your home directory instead, which doesn't require any special privileges. Read more in here.

(*) Make sure you not use pip install --user pkg_name inside a virtual environment. Read more in here.

Rot-man
  • 18,045
  • 12
  • 118
  • 124
-10

See my own comments in the post above.

Rober
  • 5,868
  • 17
  • 58
  • 110