Skip to content

module 'googleapiclient' has no attribute '__version__' #877

@christopher5106

Description

@christopher5106

Hi

When installing apiclient under python 3.8 with the latest versions, I had the following error with

    from tensorflow.python.tpu.client import client
  File "/home/cbo/miniconda3/envs/tf-2/lib/python3.8/site-packages/tensorflow/python/tpu/client/client.py", line 32, in <module>
    from apiclient import discovery  # pylint: disable=g-import-not-at-top
  File "/home/cbo/miniconda3/envs/tf-2/lib/python3.8/site-packages/apiclient/__init__.py", line 22, in <module>
    __version__ = googleapiclient.__version__
AttributeError: module 'googleapiclient' has no attribute '__version__'

I decided to comment the line __version__ = googleapiclient.__version__ in the file python3.8/site-packages/apiclient/init.py

"""Retain apiclient as an alias for googleapiclient."""

from six import iteritems

import googleapiclient

from googleapiclient import channel
from googleapiclient import discovery
from googleapiclient import errors
from googleapiclient import http
from googleapiclient import mimeparse
from googleapiclient import model

try:
    from googleapiclient import sample_tools
except ImportError:
    # Silently ignore, because the vast majority of consumers won't use it and
    # it has deep dependence on oauth2client, an optional dependency.
    sample_tools = None
from googleapiclient import schema

#__version__ = googleapiclient.__version__

_SUBMODULES = {
    "channel": channel,
    "discovery": discovery,
    "errors": errors,
    "http": http,
    "mimeparse": mimeparse,
    "model": model,
    "sample_tools": sample_tools,
    "schema": schema,
}

import sys

for module_name, module in iteritems(_SUBMODULES):
    sys.modules["apiclient.%s" % module_name] = module

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions