gpg-agent can't be reached

Answering myself in case someone else is stuck on this.

On Ubuntu 16.04, the default versions are:

    # gpg --version
    gpg (GnuPG) 1.4.20

and

    # gpg-agent --version
    gpg-agent (GnuPG) 2.1.11

They are not compatible. It is mandatory to use GPG2:

    # gpg2 --version
    gpg (GnuPG) 2.1.11

The solution is to install gpgv2 :

sudo apt install gpgv2

This is because gpg-agent that comes with Ubuntu is version 2 and it tries to connect to gpg with version 2. But Ubuntu has gpg version 1 installed.