I've been working with VSCode in a development container and had the same issue. After trying various fixes, what finally worked for me was deleting the __pycache__ folder and then restarting the development container.
__pycache__