Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import six.moves.collections_abc #45

Closed
wescpy opened this issue Nov 18, 2020 · 0 comments · Fixed by #46
Closed

ImportError: cannot import six.moves.collections_abc #45

wescpy opened this issue Nov 18, 2020 · 0 comments · Fixed by #46
Assignees

Comments

@wescpy
Copy link

wescpy commented Nov 18, 2020

Traceback (most recent call last):
    . . .
  File "/base/data/home/apps/m~PROJECT_ID/20201117t171012.431016593202024462/main.py", line 16, in <module>
    from google.cloud import ndb
  File "/base/data/home/apps/m~PROJECT_ID/20201117t171012.431016593202024462/lib/google/cloud/ndb/__init__.py", line 28, in <module>
    from google.cloud.ndb.client import Client
  File "/base/data/home/apps/m~PROJECT_ID/20201117t171012.431016593202024462/lib/google/cloud/ndb/client.py", line 26, in <module>
    from google.cloud.datastore_v1.gapic import datastore_client
  File "/base/data/home/apps/m~PROJECT_ID/20201117t171012.431016593202024462/lib/google/cloud/datastore_v1/__init__.py", line 18, in <module>
    from google.cloud.datastore_v1.gapic import datastore_client
  File "/base/data/home/apps/m~PROJECT_ID/20201117t171012.431016593202024462/lib/google/cloud/datastore_v1/gapic/datastore_client.py", line 39, in <module>
    from google.cloud.datastore.version import __version__
  File "/base/data/home/apps/m~PROJECT_ID/20201117t171012.431016593202024462/lib/google/cloud/datastore/__init__.py", line 60, in <module>
    from google.cloud.datastore.client import Client
  File "/base/data/home/apps/m~PROJECT_ID/20201117t171012.431016593202024462/lib/google/cloud/datastore/client.py", line 26, in <module>
    from google.cloud.datastore._http import HTTPDatastoreAPI
  File "/base/data/home/apps/m~PROJECT_ID/20201117t171012.431016593202024462/lib/google/cloud/datastore/_http.py", line 19, in <module>
    from google.cloud import _http as connection_module
  File "/base/data/home/apps/m~PROJECT_ID/20201117t171012.431016593202024462/lib/google/cloud/_http.py", line 22, in <module>
    from six.moves import collections_abc
ImportError: cannot import name collections_abc
  • This affects all Python 2 App Engine users as six==1.12.0 is built-in
  • The current workaround is to reference the immediately preceding version by adding google-cloud-core==1.4.1 in any affected application's requirements.txt file until either App Engine revs six to a newer release (>=1.13.0), or Line 22 of google/cloud/_http.py is patched, perhaps with something like this:
# catch six<1.13.0
try:
    from six.moves import collections_abc
except ImportError:
    # catch python<3.3.0
    try:
        import collections.abc as collections_abc # only works on 3.3+
    except ImportError:
        import collections as collections_abc
wescpy added a commit to googlecodelabs/migrate-python2-appengine that referenced this issue Nov 18, 2020
@tswast tswast self-assigned this Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants