Fixing "Could not load Boto's S3 bindings."

Problem

During installation, at the "edxapp: migrate" step, the installation fails with an error about Boto's S3 bindings:

TASK [edxapp : migrate] ********************************************************
failed: [localhost] (item=lms) => {"changed": true, "cmd": ["/edx/bin/edxapp-migrate-lms"], "delta": "0:00:02.705468", "end": "2017-03-23 20:05:07.543029", "failed": true, "item": "lms", "rc": 1, "start": "2017-03-23 20:05:04.837561", "stderr": "Traceback (most recent call last):\n  File \"manage.py\", line 111, in <module>\n    startup = importlib.import_module(edx_args.startup)\n  File \"/usr/lib/python2.7/importlib/__init__.py\", line 37, in import_module\n    __import__(name)\n  File \"/edx/app/edxapp/edx-platform/lms/startup.py\", line 21, in <module>\n    import lms_xblock.runtime\n  File \"/edx/app/edxapp/edx-platform/lms/djangoapps/lms_xblock/runtime.py\", line 9, in <module>\n    from openedx.core.djangoapps.user_api.course_tag import api as user_course_tag_api\n  File \"/edx/app/edxapp/edx-platform/openedx/core/djangoapps/user_api/course_tag/api.py\", line 10, in <module>\n    from ..models import UserCourseTag\n  File \"/edx/app/edxapp/edx-platform/openedx/core/djangoapps/user_api/models.py\", line 20, in <module>\n    from student.models import UserProfile, Registration, PendingEmailChange  # pylint: disable=unused-import\n  File \"/edx/app/edxapp/edx-platform/common/djangoapps/student/models.py\", line 49, in <module>\n    from certificates.models import GeneratedCertificate\n  File \"/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/__init__.py\", line 3, in <module>\n    from . import signals\n  File \"/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/signals.py\", line 7, in <module>\n    from certificates.models import CertificateGenerationCourseSetting\n  File \"/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/models.py\", line 69, in <module>\n    from lms.djangoapps.instructor_task.models import InstructorTask\n  File \"/edx/app/edxapp/edx-platform/lms/djangoapps/instructor_task/models.py\", line 26, in <module>\n    from openedx.core.storage import get_storage\n  File \"/edx/app/edxapp/edx-platform/openedx/core/storage.py\", line 16, in <module>\n    from storages.backends.s3boto import S3BotoStorage\n  File \"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/storages/backends/s3boto.py\", line 19, in <module>\n    raise ImproperlyConfigured(\"Could not load Boto's S3 bindings.\\n\"\ndjango.core.exceptions.ImproperlyConfigured: Could not load Boto's S3 bindings.\nSee https://github.com/boto/boto", "stdout": "", "stdout_lines": [], "warnings": []}
failed: [localhost] (item=cms) => {"changed": true, "cmd": ["/edx/bin/edxapp-migrate-cms"], "delta": "0:00:02.827814", "end": "2017-03-23 20:05:10.504582", "failed": true, "item": "cms", "rc": 1, "start": "2017-03-23 20:05:07.676768", "stderr": "Traceback (most recent call last):\n  File \"manage.py\", line 112, in <module>\n    startup.run()\n  File \"/edx/app/edxapp/edx-platform/cms/startup.py\", line 39, in run\n    django.setup()\n  File \"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/__init__.py\", line 18, in setup\n    apps.populate(settings.INSTALLED_APPS)\n  File \"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/apps/registry.py\", line 85, in populate\n    app_config = AppConfig.create(entry)\n  File \"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/apps/config.py\", line 86, in create\n    module = import_module(entry)\n  File \"/usr/lib/python2.7/importlib/__init__.py\", line 37, in import_module\n    __import__(name)\n  File \"/edx/app/edxapp/venvs/edxapp/src/edx-sga/edx_sga/__init__.py\", line 1, in <module>\n    from .sga import StaffGradedAssignmentXBlock\n  File \"/edx/app/edxapp/venvs/edxapp/src/edx-sga/edx_sga/sga.py\", line 23, in <module>\n    from student.models import user_by_anonymous_id\n  File \"/edx/app/edxapp/edx-platform/common/djangoapps/student/models.py\", line 49, in <module>\n    from certificates.models import GeneratedCertificate\n  File \"/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/__init__.py\", line 3, in <module>\n    from . import signals\n  File \"/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/signals.py\", line 7, in <module>\n    from certificates.models import CertificateGenerationCourseSetting\n  File \"/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/models.py\", line 69, in <module>\n    from lms.djangoapps.instructor_task.models import InstructorTask\n  File \"/edx/app/edxapp/edx-platform/lms/djangoapps/instructor_task/models.py\", line 26, in <module>\n    from openedx.core.storage import get_storage\n  File \"/edx/app/edxapp/edx-platform/openedx/core/storage.py\", line 16, in <module>\n    from storages.backends.s3boto import S3BotoStorage\n  File \"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/storages/backends/s3boto.py\", line 19, in <module>\n    raise ImproperlyConfigured(\"Could not load Boto's S3 bindings.\\n\"\ndjango.core.exceptions.ImproperlyConfigured: Could not load Boto's S3 bindings.\nSee https://github.com/boto/boto", "stdout": "", "stdout_lines": [], "warnings": []}

RUNNING HANDLER [mongo : restart mongo] ****************************************
        to retry, use: --limit @/var/tmp/configuration/playbooks/edx_sandbox.retry

PLAY RECAP *********************************************************************
localhost                  : ok=196  changed=130  unreachable=0    failed=1


Solution

This problem only affects Google Cloud Platform installation.

Google Compute Engine defines `BOTO_CONFIG=/etc/boto.cfg`.  In other environments (such as Amazon Web Services), the BOTO_CONFIG variable does not exist, and Boto uses its own defaults. The configuration defined by GCE defaults requires the google-compute-engine package.

There are two ways to fix this problem:

Use the GCE configuration

If you want to use the GCE configuration, you must install the google-compute-engine package into each virtualenv using Boto:

$ /edx/app/edxapp/venvs/edxapp/bin/pip install google-compute-engine

Use the Boto default configuration

If you would rather use the Boto default configuration, you can unset BOTO_CONFIG.