GSpread ImportError: No module named oauth2client.service_account

Ryan Bonhardt picture Ryan Bonhardt · Jun 16, 2016 · Viewed 14.3k times · Source

Ok I'm following along with the Become A Technical Marketer course and I'm trying to learn how to manage Google Spreadsheets with GSpread. I've followed along with the documentation at http://gspread.readthedocs.io/en/latest/oauth2.html. I've followed the steps in the second URL above and ran a document with the following code:

import gspread
from oauth2client.service_account import ServiceAccountCredentials

scope = ['https://spreadsheets.google.com/feeds']

credentials = ServiceAccountCredentials.from_json_keyfile_name('DFS Google Sheets Data Imports-7205de852ff7.json', scope)

gc = gspread.authorize(credentials)

wks = gc.open("Authority Scraper").sheet1
wks.update_cell(1,2,"Hello World!")

From that I get the error in my terminal: from oauth2client.service_account import ServiceAccountCredentials ImportError: No module named oauth2client.service_account

terminal error printout

Someone please help me. The answers with other No module named oath2client.service_account are not working for me. Thanks!

Answer

kevthanewversi picture kevthanewversi · May 19, 2017

Running this command worked for me - sudo pip install --upgrade oauth2client

Got this from the oauth2client library github repo