From time to time, I’ll get an error installing where something, probably in the downloading of a file, gets corrupted and apt/dpkg won’t complete. The error is usually with one or more files in the /var/cache/apt/archives directory.
One solution to this problem is to use dpkg itself to force the issue:
dpkg --configure -a