For me it was because I did not have a folder marked as Source Root (it appears in blue).
To fix, right click your root source directory -> Mark As -> Source Root.
For me it was because I did not have a folder marked as Source Root (it appears in blue).
To fix, right click your root source directory -> Mark As -> Source Root.