When I re-installed CTools (Chaos Tools Suite) during a Drupal 7 upgrade, it resulted in this error:

Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '29'

According to this post, it may have something to do withinsufficient memory allocation to PHP preventing hook_install from running when the module tries to load.

Since I had just increased the memory in the php.ini file, I instead disabled all CTools-related and uninstalled the CTools dependent modules like File Entity and Media, then re-enabled them in one by one order of dependency. This time there was no error.