In my case, it was caused by activating the wrong virtual environment from another folder. Activating the one I was working with solved the error.