Skip to content

Instantly share code, notes, and snippets.

@sdg7onado
Last active February 17, 2022 15:42
Show Gist options
  • Save sdg7onado/f24bb42568cc30f4631c44b1b473378f to your computer and use it in GitHub Desktop.
Save sdg7onado/f24bb42568cc30f4631c44b1b473378f to your computer and use it in GitHub Desktop.
Installing Python dependencies from behind a corporate proxy
Hi,
So recently I had a need to install Django on my corporate machine.
Since I was connected to the Internet from behind a proxy, I encountered connection errors.
I will state what I did to get this to work.
#Problem:
Unable to install Python dependencies from behind a proxy
#Assumptions
1. You have got the proxy connection details
2. Your username may contain the @ symbol.
- In the password, replace the '@' with '%40'
##Solution
#Install Django (Example 1)
pip --proxy http://username:password@ipaddress:port install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org django
#Upgrade PIP (Example 2)
pip --proxy http://username:password@ipaddress:portinstall --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --upgrade pip
Note:
1. Where the password contains the '@' symbol replace it with '%40'
2. Where there is a timeout, you may use the option '--default-timeout=100'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment