As it turned out, I had an installation issue with python. I noticed this problem when Blender would not start up. Again site.py was generating an error. When searching around I found stuff that suggested an old python executable could be in use. So I removed my python installations (both from manual install and the stuff that I got from Visual Studio). This fixed the error for both Blender and Unreal Engine.
Now I only have to reinstall python in a way that won’t break everything again.