'No module named 'gspread'

Below file runs successfully when run direct on the console, but give an error: No module named 'gspread' on server

import gspread
from oauth2client.service_account import ServiceAccountCredentials
from pprint import pprint

class GoogleSheet():

    scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"]
    #creds = ServiceAccountCredentials.from_json_keyfile_name("creds.json", scope)
    creds = gspread.service_account()
    #client = gspread.authorize(creds)

    sh = creds.open("DI ITEM SHEET")  # Open the spreadhseet
    wks = sh.worksheet("2022-APR") # Open the workhseet

    data = wks.get_all_records()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source