Search code examples
pythongoogle-cloud-platformgoogle-vision

Google Vision API: ModuleNotFoundError: module not found 'google.oauth2'


I am a making a very simple API call to the Google Vision API, but all the time it's giving me error that 'google.oauth2' module not found. I've pip installed all the dependcies. To check this, I've imported google.oauth2 module in command line Python and It's working there. Please help me with this.


Solution

  • There are multiple reasons for this:

    • Check whether you have installed dependencies in only one place or multiple places. Try to install it only in the source library folder.
    • If above doesn't solve uninstall all Google packages from your local machine, delete the lib folder in your app folder, create it again and then execute:

       pip install -t lib google-auth google-auth-httplib2 google-api-python-client --upgrade
      

    Hope this should solve your problem!!