Search code examples
pythonlinuxamazon-ec2s3cmd

s3cmd ImportError: No module named S3.Exceptions


Received an error after installing and trying to run s3cmd 1.0.0

s3cmd -h

Problem: ImportError: No module named S3.Exceptions
S3cmd:   unknown version. Module import problem?

Traceback (most recent call last):
  File "/usr/bin/s3cmd", line 1995, in <module>
    from S3.Exceptions import *
ImportError: No module named S3.Exceptions

Your sys.path contains these entries:

This error came about after upgrading to the latest Amazon Linux distro 2015.03.0


Solution

  • Looks like the error happened because python2.7 is now the default python version in the Amazon Linux 2015.03.0+ If you change python back to 2.6 and run s3cmd it should work without a problem

    update-alternatives --set python /usr/bin/python2.6
    s3cmd -h
    

    After the s3cmd command is ran you can put python back to 2.7 for yum and other utilities:

    update-alternatives --set python /usr/bin/python2.7
    yum install <package>