Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i create a new virtualenv using proxy? #1156

Closed
bolerap opened this issue Apr 3, 2018 · 1 comment
Closed

How can i create a new virtualenv using proxy? #1156

bolerap opened this issue Apr 3, 2018 · 1 comment

Comments

@bolerap
Copy link

bolerap commented Apr 3, 2018

Hi all,
my machine is under a network with proxy.
I've install a package system wide by using pip with this command pip install --proxy http://<ip:port> <package> but when i create a virtual environment by command virtualenv -p python3 venv it raise error requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7979f0b978>: Failed to establish a new connection: [Errno -5] No address associated with hostname I think this error is caused by proxy, this issued solved when i remove proxy config. I'd like to create a new virtualenv with a --proxy option or something similar like above pip? How can i do it?
Thanks.

@scottmunday84
Copy link

scottmunday84 commented May 21, 2018

If you just want to use a proxy, you can use HTTP_PROXY=, and HTTPS_PROXY= settings.

HTTP_PROXY=http://proxy:3128 HTTPS_PROXY=http://proxy:3128 virtualenv virtualenv

But if you want to guarantee the use of your WHLs, then I'd do this.

mkdir -p /opt/pypi/downloads
pushd /opt/pypi/downloads
pip download --no-cache --proxy http://proxy:3128 setuptools wheel pip
popd
virtualenv --no-download --extra-search-dir /opt/pypi/downloads virtualenv

Should take care of it.

If you are using an index URL (like Nexus3), you should try a similar approach.

mkdir -p /opt/pypi/downloads
pushd /opt/pypi/downloads
pip download --no-cache -i http://nexus3:8081/repository/pypi/simple --trusted-host nexus3 setuptools wheel pip
popd
virtualenv --no-download --extra-search-dir /opt/pypi/downloads virtualenv

Hope that helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants