gpg: can't connect to the agent: IPC connect call failed (WSL Ubuntu 20.04)

Uninstall the gpg that comes installed by default and install gnupg1 package instead

sudo apt remove gpg

sudo apt install gnupg1

This appears to be a known bug in WSL. You can try adding the key manually using:

curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=YOUR_KEY_HERE" | sudo apt-key add

YOUR_KEY_HERE is the GPG key the package you need wants to install. An example would be: 0xA6A19B38D3D831EF