On Ubuntu, you can set proxy by using
export http_proxy=http://username:password@proxy:port
export https_proxy=http://username:password@proxy:port
or if you are having SOCKS error use
export all_proxy=http://username:password@proxy:port
Then run pip
sudo -E pip3 install {packageName}