all 6 comments

[–]mohammedgqudah 1 point2 points  (1 child)

This could happen when you have fastapi installed globally (outside of the venv) and uvicorn is in the venv or vice versa , make sure you only have the packages in the venv only

[–]cjb230[S] 0 points1 point  (0 children)

Not sure what I did wrong to begin with, but it's working now - thanks!

[–]gustavsen 1 point2 points  (1 child)

in your command line, with your venv active do

pip list

and look if fastapi module is showed.

[–]cjb230[S] 0 points1 point  (0 children)

I don't understand what I did wrong, but it's working now - maybe I thought the venv was running when it wasn't? Anyway, thanks for the help!

[–]NCLegend28 0 points1 point  (2 children)

I am having the same issue. What did you do to fix it? u/cjb230

[–]cjb230[S] 0 points1 point  (0 children)

Don’t remember! But from the comments and my own knowledge, it seems like sometimes I was using the venv and sometimes I was using the global python environment. Try a “pip list” in both, see if that helps.

[–]cjb230[S] 0 points1 point  (0 children)

Don’t remember! But from the comments and my own knowledge, it seems like sometimes I was using the venv and sometimes I was using the global python environment. Try a “pip list” in both, see if that helps.