Search code examples
pythonapiimportpylance

Importing Issues in Visual Studio Code


In VS code, I am getting these Problems:

Import "flask" could not be resolved from source Pylance

it's this same problem for "googleapiclient.discovery, google_auth_oauthlib.flow, google.auth.transport.requests, and oauth2client.service_account.

At first I thought there was an issue with my pickle token or credentials file for the Google API, but those are working. I think. I then just made a blank new file, and just wrote

import pandas as pd

and I'm still getting the same error for that. I know I have pandas installed through pip. What can I do to fix this?


Solution

  • Make sure you have selected a Python environment that has the packages installed. You can also add custom search paths if necessary but the environment selection is more likely your problem. You may find this blog post helpful: https://devblogs.microsoft.com/python/python-in-visual-studio-code-july-2021-release/