tools/codegen/gen.py 9 was added quite recently, so could it be that you have updated some files but not the complete repository?
Could you clean the build via python setup.py clean, update it, and rebuild?