Though I have pip and pip3 installed fastapi library in my Ubuntu based workstation, I get a weird error saying
No module named ‘fastapi’.
I have been scratching my head since two days ago as the same code works in other laptop with same Ubuntu environment.
Uninstalled and reinstalled fastapi library
2
Answers
pip install --upgrade pip
and thenpip install fastapi again
conda install -c conda-forge fastapi
you’re not using the correct environment to run your code.
Either, 1. install the package
fast-api
in the environment you running the code in or 2. switch to the other one the packages are installed in:for 1:
sudo /bin/python3 -m pip install "fastapi[all]"
in this case you should be able to use the fast-api package
Note: the other packages you use are probably not installed as well