Repository: googleapis/google-api-python-client

Issue:
Discovery checks for removed oauth2client dependency 
In 9eb303e10cc9d6aa09137d1d68a0673e5aa5b4b0, 3 days ago, the dependency on `oauth2client` was dropped (yay!), but it seems that the Discovery API client is still checking for oauth2client in [apiclient/\_\_init\_\_.py](https://github.com/google/google-api-python-client/blob/081d2a336393a5d497339e462875294cfd8c81ea/apiclient/__init__.py#L7-L16) and claiming I need to upgrade my installation of `google-api-python-client`. Running `pip install -I google-api-python-client` doesn't clear the error message.

```
$ python3 -m venv test-gapi
epall@Calypso:/private/tmp
$ . test-gapi/bin/activate
(test-gapi) epall@Calypso:/private/tmp
$ pip freeze
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(test-gapi) epall@Calypso:/private/tmp
$ pip install google-api-python-client
Collecting google-api-python-client
  Using cached https://files.pythonhosted.org/packages/77/24/6a493cff23e60d882598e92b03d9f2c3c77299a9578b4411636616c039f4/google_api_python_client-1.7.1-py2.py3-none-any.whl
Collecting uritemplate<4dev,>=3.0.0 (from google-api-python-client)
  Using cached https://files.pythonhosted.org/packages/e5/7d/9d5a640c4f8bf2c8b1afc015e9a9d8de32e13c9016dcc4b0ec03481fb396/uritemplate-3.0.0-py2.py3-none-any.whl
Collecting httplib2<1dev,>=0.9.2 (from google-api-python-client)
Collecting google-auth>=1.4.1 (from google-api-python-client)
  Using cached https://files.pythonhosted.org/packages/53/06/6e6d5bfa4d23ee40efd772d6b681a7afecd859a9176e564b8c329382370f/google_auth-1.5.0-py2.py3-none-any.whl
Collecting google-auth-httplib2>=0.0.3 (from google-api-python-client)
  Using cached https://files.pythonhosted.org/packages/33/49/c814d6d438b823441552198f096fcd0377fd6c88714dbed34f1d3c8c4389/google_auth_httplib2-0.0.3-py2.py3-none-any.whl
Collecting six<2dev,>=1.6.1 (from google-api-python-client)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting cachetools>=2.0.0 (from google-auth>=1.4.1->google-api-python-client)
  Using cached https://files.pythonhosted.org/packages/0a/58/cbee863250b31d80f47401d04f34038db6766f95dea1cc909ea099c7e571/cachetools-2.1.0-py2.py3-none-any.whl
Collecting rsa>=3.1.4 (from google-auth>=1.4.1->google-api-python-client)
  Using cached https://files.pythonhosted.org/packages/e1/ae/baedc9cb175552e95f3395c43055a6a5e125ae4d48a1d7a924baca83e92e/rsa-3.4.2-py2.py3-none-any.whl
Collecting pyasn1-modules>=0.2.1 (from google-auth>=1.4.1->google-api-python-client)
  Using cached https://files.pythonhosted.org/packages/e9/51/bcd96bf6231d4b2cc5e023c511bee86637ba375c44a6f9d1b4b7ad1ce4b9/pyasn1_modules-0.2.1-py2.py3-none-any.whl
Collecting pyasn1>=0.1.3 (from rsa>=3.1.4->google-auth>=1.4.1->google-api-python-client)
  Using cached https://files.pythonhosted.org/packages/a0/70/2c27740f08e477499ce19eefe05dbcae6f19fdc49e9e82ce4768be0643b9/pyasn1-0.4.3-py2.py3-none-any.whl
Installing collected packages: uritemplate, httplib2, cachetools, pyasn1, rsa, pyasn1-modules, six, google-auth, google-auth-httplib2, google-api-python-client
Successfully installed cachetools-2.1.0 google-api-python-client-1.7.1 google-auth-1.5.0 google-auth-httplib2-0.0.3 httplib2-0.11.3 pyasn1-0.4.3 pyasn1-modules-0.2.1 rsa-3.4.2 six-1.11.0 uritemplate-3.0.0
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(test-gapi) epall@Calypso:/private/tmp
$ python
Python 3.6.5 (default, Apr 10 2018, 11:19:37)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import apiclient.discovery
Traceback (most recent call last):
  File "/private/tmp/test-gapi/lib/python3.6/site-packages/apiclient/__init__.py", line 8, in <module>
    import oauth2client
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/private/tmp/test-gapi/lib/python3.6/site-packages/apiclient/__init__.py", line 11, in <module>
    'Previous version of google-api-python-client detected; due to a '
RuntimeError: Previous version of google-api-python-client detected; due to a packaging issue, we cannot perform an in-place upgrade. To repair, remove and reinstall this package, along with oauth2client and uritemplate. One can do this with pip via
  pip install -I google-api-python-client
>>>
```


Discussion:

Resolving patch:
diff --git a/apiclient/__init__.py b/apiclient/__init__.py
--- a/apiclient/__init__.py
+++ b/apiclient/__init__.py
@@ -4,17 +4,6 @@
 
 import googleapiclient
 
-try:
-  import oauth2client
-except ImportError:
-  raise RuntimeError(
-      'Previous version of google-api-python-client detected; due to a '
-      'packaging issue, we cannot perform an in-place upgrade. To repair, '
-      'remove and reinstall this package, along with oauth2client and '
-      'uritemplate. One can do this with pip via\n'
-      '  pip install -I google-api-python-client'
-  )
-
 from googleapiclient import channel
 from googleapiclient import discovery
 from googleapiclient import errors


Test patch: