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}
The pip’s proxy parameter is, according to pip --help, in the form scheme://[user:passwd@]proxy.server:port
You should use the following:
pip install --proxy http://user:password@proxyserver:port TwitterApi
Also, the HTTP_PROXY env var should be respected.