question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

module 'six.moves' has no attribute 'collections_abc

See original GitHub issue

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you’ve tried the usual “quick fixes”:

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • MacOS Catalina:
  • Python version: 3.6.5
  • pip version: 21.0.1
  • google-api-python-client version: 2.0.2

Steps to reproduce

  1. install google-api-python-client
  2. run the code

Code example

youtube = discovery.build('youtube', 'v3', static_discovery=False)
request = youtube.search().list(
    part="snippet",
    maxResults=25,
    q="surfing"
)

response = request.execute()
print(response)

Stack trace

AttributeError                            Traceback (most recent call last)
<ipython-input-202-2092acf85a22> in <module>()
     24     print(response)
     25 
---> 26 serialized_users = search_users(queries)

<ipython-input-202-2092acf85a22> in search_users(queries)
      3     for query in queries:
      4         search_twitter(query, results)
----> 5         search_youtube(query, results)
      6     return results
      7 

<ipython-input-202-2092acf85a22> in search_youtube(query, results)
     14 
     15 def search_youtube(query, results):
---> 16     youtube = discovery.build('drive', 'v3', static_discovery=False)
     17     request = youtube.search().list(
     18         part="snippet",

~/anaconda3/lib/python3.6/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
    132                 elif positional_parameters_enforcement == POSITIONAL_WARNING:
    133                     logger.warning(message)
--> 134             return wrapped(*args, **kwargs)
    135 
    136         return positional_wrapper

~/anaconda3/lib/python3.6/site-packages/googleapiclient/discovery.py in build(serviceName, version, http, discoveryServiceUrl, developerKey, model, requestBuilder, credentials, cache_discovery, cache, client_options, adc_cert_path, adc_key_path, num_retries, static_discovery)
    292                 client_options=client_options,
    293                 adc_cert_path=adc_cert_path,
--> 294                 adc_key_path=adc_key_path,
    295             )
    296             break  # exit if a service was created

~/anaconda3/lib/python3.6/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
    132                 elif positional_parameters_enforcement == POSITIONAL_WARNING:
    133                     logger.warning(message)
--> 134             return wrapped(*args, **kwargs)
    135 
    136         return positional_wrapper

~/anaconda3/lib/python3.6/site-packages/googleapiclient/discovery.py in build_from_document(service, base, future, http, developerKey, model, requestBuilder, credentials, client_options, adc_cert_path, adc_key_path)
    491     if client_options is None:
    492         client_options = google.api_core.client_options.ClientOptions()
--> 493     if isinstance(client_options, six.moves.collections_abc.Mapping):
    494         client_options = google.api_core.client_options.from_dict(client_options)
    495 

AttributeError: module 'six.moves' has no attribute 'collections_abc'

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ecoulsoncommented, Mar 4, 2021

On the unrelated note, I agree. I was just trying to see if anything would fix it.

On the topic of six being too old, when i run pip show six --version I get this as the module data

Name: six
Version: 1.15.0
Summary: Python 2 and 3 compatibility utilities
Home-page: https://github.com/benjaminp/six
Author: Benjamin Peterson
Author-email: benjamin@python.org
License: MIT
Location: /Users/evancoulson/anaconda3/lib/python3.6/site-packages
Requires: 
Required-by: tweepy, traitlets, tables, Sphinx, singledispatch, scikit-image, QtAwesome, python-dateutil, pytest, pytest-remotedata, pytest-doctestplus, pytest-arraydiff, pyOpenSSL, pylint, protobuf, prompt-toolkit, patsy, pathlib2, packaging, nltk, more-itertools, matplotlib, html5lib, h5py, google-auth, google-auth-httplib2, google-api-python-client, google-api-core, Flask-Cors, distributed, cycler, cryptography, bokeh, bleach, bkcharts, astroid, anaconda-client

So I feel like it should be using the newest version of six

1reaction
busunkim96commented, Mar 4, 2021

Hi,

It looks like the version of six that’s currently installed is too old. Could you try upgrading your version of six?

collections_abc was added in 1.13.0 (six changelog) so our setup.py pins six>=1.13.0. Strange things can happen in existing environments sometimes though.

Unrelated: I would strongly recommend going with static_discovery=True (the new default behavior) for better reliability. Otherwise behavior may change unexpectedly between different executions of the same code. https://github.com/googleapis/google-api-python-client/blob/master/UPGRADING.md#200-migration-guide

Read more comments on GitHub >

github_iconTop Results From Across the Web

module 'six.moves' has no attribute 'collections_abc'
simply run pip install --upgrade six The cause of this issue is usually that the module 'six' in your local environment is out...
Read more >
module 'six.moves' has no attribute 'collections_abc'" · Issue ...
I encountered this error message when I was trying to use google analytics API in python AttributeError: module 'six.moves' has no attribute ...
Read more >
module 'six.moves' has no attribute 'collections_abc'
AttributeError : module 'six.moves' has no attribute 'collections_abc · Uninstall and download sources : · Change setup.py by changing · Install ...
Read more >
Six: Python 2 and 3 Compatibility Library — six 1.15.0 ...
Create a mapping for six.moves called name that references different attributes in Python 2 and 3. old_mod is the name of the Python...
Read more >
attributeerror: module 'collections' has no attribute 'sequence'
Deprecated since version 3.3, will be removed in version 3.10: Moved Collections Abstract Base Classes to the collections.abc module. For backwards ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found