It seems like python and pip packages are corrupted. Try the following :
Let me know if it works. I installed 'scratch' but i encountered exactly same error.Then I did this and it ran smoothly.