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

file_cache is unavailable when using oauth2client >= 4.0.0 #299

Closed
bivald opened this issue Oct 23, 2016 · 22 comments
Closed

file_cache is unavailable when using oauth2client >= 4.0.0 #299

bivald opened this issue Oct 23, 2016 · 22 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@bivald
Copy link

bivald commented Oct 23, 2016

This is related to #294

After upgrading google-api-python-client and oauth2client I get:

Oct 23 11:26:30 admin [11:26:30][WARNING] googleapiclient.discovery_cache init.py:autodetect:44 | file_cache is unavailable when using oauth2client >= 4.0.0#012Traceback (most recent call last):#12 File "/usr/share/python/.../local/lib/python2.7/site-packages/googleapiclient/discovery_cache/init.py", line 41, in autodetect#012 from . import file_cache#012 File "/usr/share/python/..../local/lib/python2.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in #12 'file_cache is unavailable when using oauth2client >= 4.0.0')#012ImportError: file_cache is unavailable when using oauth2client >= 4.0.0

I know that it was added to add oauth2client support (which I appreciate) and from what I can see doesn't actually abort any action - but would it be possible to remove the WARNING as well - or is it meant as a future todo?

It's not a huge issue, but possibly confusing to others - not to mention my eyes stopping at it every time I view any logs or monitoring.

@theacodes
Copy link
Contributor

You can silence this the same way you can silence any other log using the standard library logging infrastructure:

import logging

logging.getLogger('googleapicliet.discovery_cache').setLevel(logging.ERROR)

@bivald
Copy link
Author

bivald commented Oct 25, 2016

Of course you can! I apologize, I blame the lack of coffee for my ignorance.

@theacodes
Copy link
Contributor

No worries. :)

@dsoprea
Copy link

dsoprea commented Dec 8, 2016

Are we sure that this is that simple? I have a project that I'm getting reports of seizing/crashing/weirdness with and I'm seeing these all over the log (no other issues):

2016-12-08 20:11:27,816 [googleapiclient.discovery_cache WARNING] file_cache is unavailable when using oauth2client >= 4.0.0
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
    from . import file_cache
  File "/usr/lib/python2.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in <module>
    'file_cache is unavailable when using oauth2client >= 4.0.0')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0

These are ImportErrors, not just mere log verbosity. Thoughts?

@dsoprea
Copy link

dsoprea commented Dec 8, 2016

It's worth mentioning that my version reference to google-api-python-client hasn't changed in over 2.5 years. I can't fathom why I haven't seen this error before and why it appears to be an issue now. But, it does appear to be an exception which must be disrupting something whether it's specifically related to my user's issue or something silent from the logs is responsible for that.

@theacodes
Copy link
Contributor

@dsoprea if you silence the logs as above, do you still see the stacktrace?

@dsoprea
Copy link

dsoprea commented Dec 8, 2016

@jonparrott I've asked. Thanks.

@xmedeko
Copy link
Contributor

xmedeko commented Dec 22, 2016

I apologize to comment on closed issue, but is there any performance penalty when the file_cache is not used with oauth2client 4.0.0? I.e. should I keep the oauth2client 3.0.0 or may I safely upgrade and ignore the warning? Thanks.

@maxrp
Copy link

maxrp commented Dec 22, 2016

It seems to be the better way to silence this error, if one does not care about the cache, is to simply specify cache_discovery=False when performing discovery.build() -- this avoids the broken code path.

@WiliTest
Copy link

WiliTest commented Mar 21, 2017

maxrp solution worked (python3.6) for most logging message: discovery.build('drive', 'v3', http=http, cache_discovery=False)

but I also needed to set the logging level of the googleapiclient.discovery using jonparrott proposition:
logging.getLogger('googleapiclient.discovery').setLevel(logging.CRITICAL)

@sendvibe
Copy link

sendvibe commented Nov 9, 2017

jonparrott's answer almost worked for me.... you just have to fix the typo:

import logging
logging.getLogger('googleapiclient.discovery_cache').setLevel(logging.ERROR)

@googleapis googleapis unlocked this conversation Dec 8, 2020
saffaalvi pushed a commit to StatCan/kubeflow that referenced this issue Feb 11, 2021
* kfctl: existing_arrikto: initial e2e test

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* fix deployment name and review comment

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* fix bad syntax with extend

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* increase timeout for service ip discovery

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* update deployments to reflect latest manifests

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* skip knative for existing_arrikto

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* bump machine size and increase timeout

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* python script: fix error in delete step

Related:
googleapis/google-api-python-client#299

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* be more conservative in adding new test

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* revert checklist

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
saffaalvi pushed a commit to StatCan/kubeflow that referenced this issue Feb 12, 2021
* kfctl: existing_arrikto: initial e2e test

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* fix deployment name and review comment

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* fix bad syntax with extend

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* increase timeout for service ip discovery

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* update deployments to reflect latest manifests

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* skip knative for existing_arrikto

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* bump machine size and increase timeout

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* python script: fix error in delete step

Related:
googleapis/google-api-python-client#299

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* be more conservative in adding new test

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* revert checklist

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
adelpopelkova pushed a commit to adelpopelkova/junior.guru that referenced this issue Mar 1, 2021
b4tman added a commit to b4tman/sync_ics2gcal that referenced this issue May 1, 2021
to suppress errors in logs:
file_cache is unavailable when using oauth2client >= 4.0.0

googleapis/google-api-python-client#299
googleapis/google-api-python-client#325
sctweedie added a commit to sctweedie/csvsync that referenced this issue Jun 26, 2021
Cache discovery seems broken atm, disable it to suppress python import errors.

See

googleapis/google-api-python-client#299
seanbreckenridge added a commit to seanbreckenridge/albums_old that referenced this issue Feb 3, 2022
@mohitjoshi155
Copy link

file_cache is only supported with oauth2client<4.0.0
i am getting this error still

@sabuhigr
Copy link

init: file_cache is only supported with oauth2client<4.0.0

Still getting error.

@mabusdogma
Copy link

Still... still getting this error

@rnag
Copy link

rnag commented Apr 13, 2023

Same.. please fix. Tuning down error log messages is a workaround rather than a fix.

@trizko
Copy link

trizko commented Aug 9, 2023

For anyone landing on this issue in 2023, maxrp's solution from 2016 still works, setting cache_discovery=False:

from googleapiclient.discovery import build

client = build('drive', 'v3', cache_discovery=False)

kaylynnw pushed a commit to focused-labs/ai-knowledge-base-demo that referenced this issue Sep 18, 2023
kaylynnw pushed a commit to focused-labs/ai-knowledge-base-demo that referenced this issue Sep 19, 2023
dskecse added a commit to stachern/bseu_schedule that referenced this issue Dec 28, 2023
* This disables the following warning produced by `googleapiclient`

    WARNING:googleapiclient.discovery_cache:file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth

* googleapis/google-api-python-client#299
dskecse added a commit to stachern/bseu_schedule that referenced this issue Dec 28, 2023
* Remove locked `google-auth` version

* This helps resolve the ResolutionImpossible error while installing
  packages from requirements.txt on Python 3.11

* Change runtime to `python311`

* Remove `libraries` entry from `app.yaml`

* Update `Jinja2` package for compatibility

* Enable legacy bundled services on Python3 runtime
* https://cloud.google.com/appengine/docs/standard/python3/services/access

* Drop `lib` dir

* Point `gae-sessions` to `python3-compat` branch

* Remove no longer supported fields from `app.yaml`
* https://cloud.google.com/appengine/docs/standard/python3/migrate-to-python3/config-files

* Remove `threadsafe` entry from `app.yaml`
* All apps are presumed to be threadsafe in Python3 runtime
* https://cloud.google.com/appengine/docs/standard/python3/migrate-to-python3/config-files

* Replace `handlers: script` value w/ `auto`
* https://cloud.google.com/appengine/docs/standard/python3/migrate-to-python3/config-files#python-3

* Remove `env_variables` section from `app.yaml`
* The `DJANGO_SETTINGS_MODULE` env variable had to be set to the name of the Django settings module, typically 'settings', before packages got imported back on the legacy Python2 runtime
* https://cloud.google.com/appengine/docs/legacy/standard/python/tools/using-libraries-python-27#django

* Remove ignored `appengine_config.py`
* https://cloud.google.com/appengine/migration-center/standard/migrate-to-second-gen/python-differences#configuration
* Replaced w/ a call to `wrap_wsgi_app`
* The new `wrap_wsgi_middleware` decorator is created to configure `SessionMiddleware`

* Replace `CURRENT_VERSION_ID` w/ `GAE_VERSION`

* `GAE_VERSION` holds the current version label of the service
* https://cloud.google.com/appengine/docs/standard/python3/runtime#environment_variables

* Determine environment using `GAE_ENV` variable

* Update `ae_helpers`

* Disable "file_cache is unavailable" warning

* This disables the following warning produced by `googleapiclient`

    WARNING:googleapiclient.discovery_cache:file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth

* googleapis/google-api-python-client#299

* Add `.gcloudignore`
TimidRobot added a commit to creativecommons/quantifying that referenced this issue Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests