Whenever I got this error while I was running my code on jupyter notebook, I solved it by logging out, and closing my browser. When re-started my jupyter notebook, and re-running same code it usually works! But if you are running it through any other application or via command line then ignore this answer!