When I did not install the module "flask" in the Python environment currently used in VSCode:

Please use the command "pip --version" to check the source of the module installation tool "pip", the module is installed at this location:

Then, we can use the command "pip show flask" to check the installation location of the module "flask": (It checks whether the installation location of the module is consistent with the Python environment displayed in the lower left corner of VSCode.)

If the "reportMissingModuleSource" message is still displayed here, please reload VS Code.
(F1, Developer: Reload Window)

When I did not install the module "flask" in the Python environment currently used in VSCode:

Please use the command "pip --version" to check the source of the module installation tool "pip", the module is installed at this location:

Then, we can use the command "pip show flask" to check the installation location of the module "flask": (It checks whether the installation location of the module is consistent with the Python environment displayed in the lower left corner of VSCode.)

If the "reportMissingModuleSource" message is still displayed here, please reload VS Code.
(F1, Developer: Reload Window)

Are you using a Virtualenv? If so make sure that VSCode is using the virtualenv as your python interpreter, otherwise it will not be able to pick up the packages that you installed inside this virtualenv.
To do so, click on the Python interpreter in your bottom bar, you should get a list of possible python interpreters including your virtualenv.
python - ImportError: "flask_sqlalchemy" could not be resolved - Stack Overflow
python - Import "flask" could not be resolved from source Pylance (reportMissingModuleSource) - Stack Overflow
python - Import "flask_sqlalchemy" could not be resolved from source: Pylance - Stack Overflow
Import x could not be resolvedPylancereportMissingImports - wsl + asdf-vm
Videos
I had the same error. Changed my system python by doing the following in VS Code: Under the view menu select 'show command pallet'. One of the commands you can then select from the command palette is 'Python: Select Interpreter'. Selecting this option will allow you to choose which version of python to use.
This post is pretty old but I found a different solution that might help others out. For me, the issue was my IDE/Python (venv). I am using Visual Studio ver. 1.57.1 as of now on Windows 10.
- Open Visual Code.
- Go to 'View' on the toolbar.
- Click on 'Command Palette...' (or press CTRL + SHIFT + P on Windows).
- Search for: 'Python Select Interpreter'.
- Click on: 'Enter interpreter path...' followed by 'Find...'.
- Go to your (venv) scripts folder:
project_folder/venv/Scripts. - Select
python.exeorpythonw.exeinside of yourproject_folder/venv/Scriptsfolder.
That's all.
The Flask-SQLAlchemy was installed in my virtual environment (venv). But my VSCode was using the system/PC Python interpreter to find the packages instead of the venv.
Hope this helps someone else out.
When I did not install the module "flask" in the Python environment currently used in VSCode:

Please use the command "pip --version" to check the source of the module installation tool "pip", the module is installed at this location:

Then, we can use the command "pip show flask" to check the installation location of the module "flask": (It checks whether the installation location of the module is consistent with the Python environment displayed in the lower left corner of VSCode.)

If the "reportMissingModuleSource" message is still displayed here, please reload VS Code.
(F1, Developer: Reload Window)

Are you using a Virtualenv? If so make sure that VSCode is using the virtualenv as your python interpreter, otherwise it will not be able to pick up the packages that you installed inside this virtualenv.
To do so, click on the Python interpreter in your bottom bar, you should get a list of possible python interpreters including your virtualenv.
I was having the same problem, I messed around a lot reinstalling things so I'm not 100% sure what the perfect solution is but this is what finally worked for me.
View -> Command Pallete -> Python: Select Interpreter -> Select the version that says 'Global'
Then follow the same steps but instead select the version that says 'Recommended'.
I am assuming it somehow reinitialized the version of python I was trying to use.
I was having the same problem, but I was using pipenv which sets up a special environment for the execution with the python modules installed in that environment. When I execute the "pipenv shell" command, the response shows me the environment that is created and has the version of the interpreter that should be used for this environment.
The line I get is: myuser@Pspec7:~/pydev/flask$ . /home/myuser/.local/share/virtualenvs/flask-E0DF0fBp/bin/activate
When you get to the point where you can select your interpreter: In the interpreter list look for the path that corresponds to your environment.
From the line above, my interpreter was: Python 3.8.10 ('flask-E0DF0fBp')
This was for me. You need to look for your correspoding string. Without setting the interpreter correctly, it cannot look through the packages you have installed.
I am using virtualenv and I install flask-sqlaclchemy using pip install Flask-SQLAlchemy but still the vscode give an error
Check for the current Python Interpreter VSCode is using
Ctrl+P.Add your virtual environment PATH where your module is installed in
'C:\Users\<username>\.virtualenvs\<virtualenvname>\Scripts\python'.
You need to add your current working directory to the Python search path. This can be done with an environment variable:
export PYTHONPATH=.
There is a similar question here: Import "flask" could not be resolved from sourcePylancereportMissingModuleSource
I upgraded my pip and made sure that I installed sql-alchemy. I also am not runnign a virtual environment. How would I fix this issue ?