CircleCI build is failing due to NO PUBKEY

That looks much like the issue here

you reference python 3.x a lot in the script but are then using the command pip, which will relate to the Ubuntu-installed python 2.x environment. The command pip3 exists for working with python 3.x

The issue here is more about your deployment and use of Ubuntu than the CircleCI tool set, so the amount of help I can provide will be limited as I do not know python. You may want to simplify your build script and debug the process step by step.