When I saw “attempted relative import with no known parent package,” I realized it happens if you run a module as a standalone script that uses relative imports.
Relative imports depend on the module being inside a package. The solution I use is either switch to absolute imports or execute the module using the -m
option so Python knows the package structure.
Avoid running files with relative imports directly via python filename.py.