We Are Going To Discuss About ModuleNotFoundError: No module named ‘fastapi’. So lets Start this Python Article.
ModuleNotFoundError: No module named ‘fastapi’
- How to solve ModuleNotFoundError: No module named 'fastapi'
The error comes from the fact that you were not using the right environment and python version on VSCODE.
Your environment knew your different packages, but VSCode probably did not take them into account.
The solution was, in VSCODE:CTRL + SHIFT + P
thenPython:select interpreter
and choose the version of python linked to your environment.
You can try to change the version of python to see the consequences on your imports - ModuleNotFoundError: No module named 'fastapi'
The error comes from the fact that you were not using the right environment and python version on VSCODE.
Your environment knew your different packages, but VSCode probably did not take them into account.
The solution was, in VSCODE:CTRL + SHIFT + P
thenPython:select interpreter
and choose the version of python linked to your environment.
You can try to change the version of python to see the consequences on your imports
Solution 1
The error comes from the fact that you were not using the right environment and python version on VSCODE.
Your environment knew your different packages, but VSCode probably did not take them into account.
The solution was, in VSCODE: CTRL + SHIFT + P
then Python:select interpreter
and choose the version of python linked to your environment.
You can try to change the version of python to see the consequences on your imports
Original Author fchancel Of This Content
Solution 2
Try this to install all dependencies:
$ pip install "fastapi[all]"
Original Author Berzeker Of This Content
Solution 3
Try this :
python -m pip install fastapi uvicorn[standard]
Original Author Wahib Mzali Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.