1

I was able to install boto==2.9.0 inside global site-packages, but when I try to install the same within a virtualenv, it fails with the following error.

Running setup.py egg_info for package boto
Traceback (most recent call last):
  File "<string>", line 16, in <module>
  File "/home/khanio/.virtualenvs/test-boto/build/boto/setup.py", line 37, in <module>
    from boto import __version__
  File "boto/__init__.py", line 43, in <module>
    config = Config()
  File "boto/pyami/config.py", line 73, in __init__
    self.load_credential_file(full_path)
  File "boto/pyami/config.py", line 84, in load_credential_file
    self.readfp(c_data)
  File "/usr/lib/python2.7/ConfigParser.py", line 324, in readfp
    self._read(fp, filename)
  File "/usr/lib/python2.7/ConfigParser.py", line 546, in _read
    raise e
ConfigParser.ParsingError: File contains parsing errors: <???>
    [line  2]: '-----BEGIN RSA PRIVATE KEY-----\r\n'
    .......

I tried the same on Mountain Lion and Ubuntu 12.04, both have got python 2.7.4 installed, and on both it fails to install within a virtualenv.

Babu
  • 2,548
  • 3
  • 30
  • 47
Zakiullah Khan
  • 1,445
  • 2
  • 15
  • 26
  • have you passed `--system-site-packages` option while creating virtual env? Also you use `pip` or what? – Babu Apr 30 '13 at 05:24
  • Well I am trying to install boto within a virtualenv with no site-packages support and I am using pip. The same error pops when tried with easy_install. – Zakiullah Khan Apr 30 '13 at 05:41
  • I hope you don't use `sudo`. – Babu Apr 30 '13 at 05:59
  • Seems like there is an Exception occur when you try to load the AWS configuration file. https://github.com/boto/boto/blob/develop/boto/pyami/config.py#L73. Dig through the code, may be you'll able to identify the root cause. For me it looks like permission issue. – Babu Apr 30 '13 at 06:06
  • pip install boto reads `/etc/boto.cfg` and `~/.boto`, as well as the `BOTO_CONFIG` and `BOTO_PATH` environment variables. Do you have those files / variables and are the contents perhaps wrong? – Thomas Fenzl Apr 30 '13 at 06:26
  • @ThomasFenzl I have already got the ~/.boto config file in place. – Zakiullah Khan Apr 30 '13 at 06:59
  • I just tested, and worked fine for me. Mountain Lion, VirtualenvWrapper, python 2.7.2 – kelsmj Apr 30 '13 at 10:29

1 Answers1

2

I think the problem is that you have the environment variable AWS_CREDENTIAL_FILE set but it appears to be pointing to a file containing a private key rather than an AWSAccessKeyId and AWSSecretKey value.

Try un-setting this environment variable and trying the installation again.

garnaat
  • 44,310
  • 7
  • 123
  • 103
  • I did have the AWS_CREDENTIAL_FILE env variable defined, as you said after removing it and reloading bash shell, the error still shows up. – Zakiullah Khan May 01 '13 at 00:49
  • Hmm. I think the only way this part of code could execute is if that environment variable is present. I think somehow that environment variable is still set when the installer is being run. – garnaat May 01 '13 at 03:02
  • 1
    On further global env inspection I noticed one of my shell script used to automate failover ec2 instance recovery was setting the AWS_CREDENTIAL_FILE variable on shell start. Thanks for the direction. – Zakiullah Khan May 01 '13 at 10:45