Sometimes there may be another process that locks dpkg, or possibly by running CTRL-C during last install script execution, the installer may still hold the lock dpkg.
To resolve this, first run:
lsof /var/lib/dpkg/lock
Then run the following to get the process holding the lock:
ps cax | grep PID
If it is running, kill the process and wait a bit to try install again.
kill PID
or kill -9 PID
Now that there’s no process holding the lock, you’re likely in a good shape now.