2

I am trying to use google.oauth2, google_auth_oauthlib.flow and googleapiclient.discovery for my web app. But I'm getting these errors:

Import "google.auth.transport.requests" could not be resolved
Import "google.oauth2.credentials" could not be resolved
Import "googleapiclient.discovery" could not be resolved

And output is : from google.auth.transport.requests import Request ModuleNotFoundError: No module named 'google' Here's my pip list :

    google                   3.0.0
    google-api-core          2.8.2
    google-api-python-client 2.51.0
    google-auth              2.8.0
    google-auth-httplib2     0.1.0
    google-auth-oauthlib     0.5.2
    googleapis-common-protos 1.56.3
    gspread                  5.4.0
    httplib2                 0.20.4
    oauth2client             4.1.3
    oauthlib                 3.2.0
    requests                 2.28.0
    requests-oauthlib        1.3.1

Why am I getting these errors and how to resolve them?

3
  • 2
    Please post the actual text of the errors and your pip list, images are hard to use for debugging. Commented Jun 22, 2022 at 13:43
  • VS Code cannot find the google module. But it is available in pip and pip3 lists. I'm getting ReportMissingError : Import "google_auth_oauthlib.flow" could not be resolvedPylancereportMissingImports Commented Jun 22, 2022 at 13:47
  • Please edit your question to remove the images of text; do not write the error messages in a comment, as those don't format too well. Commented Jun 23, 2022 at 1:00

1 Answer 1

6

Maybe there is more than one python environment on your machine, please use CTRL + SHIFT + P to open the command palette type and select Python: Select Interpreter (or click on the interpreter version displayed in the lower right corner).

enter image description here

Choose the correct python interpreter and this will solve your problem.

Sign up to request clarification or add additional context in comments.

1 Comment

I had to make sure the python version I used to create my virtual environment (venv) matched the VSCode interpreter version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.