If you are running FastAPI in pycharm, the problem might be originated because you've chosen the wrong interpreter.
As soon as you change to the one of your project, the problem goes away :-)