title: How do I use google.oauth2 python library?
body: <p>I'm trying to just make a simple rest call to a secure predict endpoint for a google machine learning project but it can't find the google.oauth2 module. This is my code:</p>
  
  <pre><code>import urllib2
  from google.oauth2 import service_account
  
  # Constants
  ENDPOINT_URL = 'ml.googleapis.com/v1/projects/{project}/models/{model}:predict?access_token='
  SCOPES = ['https://www.googleapis.com/auth/sqlservice.admin']
  SERVICE_ACCOUNT_FILE = 'service.json'
  
  credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
  access_token=credentials.get_access_token()
  
  opener = urllib2.build_opener(urllib2.HTTPHandler)
  request = urllib2.Request(ENDPOINT_URL)
  request.get_method = lambda: 'POST'
  result = opener.open(request).read()
  print(str(result))
  </code></pre>
  
  <p>When I run this I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "wakeUpMLServer.py", line 30, in &lt;module&gt;
      from google.oauth2 import service_account
  ImportError: No module named oauth2
  </code></pre>
  
  <p>I installed the google-api-python-client library using pip (from instructions here: <a href="https://developers.google.com/api-client-library/python/apis/oauth2/v1" rel="noreferrer">https://developers.google.com/api-client-library/python/apis/oauth2/v1</a>). The install said it was successful.
  Python version: 2.7.6
  Pip version: 1.5.4</p>
  
  <p>In case it is somehow conflicting you should know I also do protobuf file processing on the same server, so I have the protobufs library installed as well. When I do pip list it shows both libraries:</p>
  
  <pre><code>google-api-python-client (1.6.7)
  protobuf (3.1.0.post1)
  </code></pre>
  
  <p>Is there some special way I should be installing the module? How do I verify that the module was installed? Is there any simpler way to just make a simple rest call to a secured ml endpoint that just uses the Rest API and no python?</p>