This article is from the PGP FAQ, by Jeff Licquia email@example.com with numerous contributions by others.
Most likely this is caused because PGP can't create the public and
private key ring files. If PGPPATH isn't defined, PGP will try to put
those files in the subdirectory ".pgp" off your home directory. It
will not create the directory if needed, so if the directory's not
there already, PGP will crash after generating the key.
There are two solutions: set the PGPPASS environment variable to point
to the location of your key rings, or run a "mkdir $HOME/.pgp" before
generating your key.