Pip Install Using Proxy In A Virtual Environment
I work on a Ubuntu VM in my company's laptop which uses proxy server for connecting to internet. After some research I found out how to install modules using pip install with proxy
Solution 1:
Meanwhile, I know the solution. pip
needs the environment variable HTTP_PROXY
and HTTPS_PROXY
in capital letters, instead of http_proxy
.
So append below text pattern at the end of your your '~/.bashrc'
HTTP_PROXY=http://username:pass@proxyaddress:port
export HTTP_PROXY
HTTPS_PROXY=http://username:pass@proxyaddress:port
export HTTPS_PROXY
Then, run source ~/.bashrc
Now you can install all python packages using pip
in your Ubuntu VM with proxy login.
Solution 2:
Do not activate the virtualenv and run your pip install --proxy ...
command with the full path to your virtualenv pip i.e.
C:\Users\name\myvenv\Scripts\pip install --proxy=http://user:pass@<proxy_address>:<portnumber> virtualenv
Solution 3:
You might need to exit out of virtualenv and install packages offline. Download packages with:
pip download -d <path/to/downloads/> {package_name | -r requirements.txt}
Then enter your virtualenv, install packages with:
pip install {package_name| -r requiements.txt} --no-index --find-links <path/to/downloads/>
Post a Comment for "Pip Install Using Proxy In A Virtual Environment"