pip install package via proxy - python

I tried to pip install using proxy, the proxy setting is correct because it works for npm install . what i tried is as below shown but got error message. any idea will be more than welcome!
set http_proxy=http://<username>:<password>#<proxy_server>:<port>
set https_proxy=https://<username>:<password>#<proxy_server>:<port>
pip install Flask
Collecting Flask
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
Could not find a version that satisfies the requirement Flask (from versions: )
No matching distribution found for Flask

pip install packageName --proxy proxy_Server:portnumber
ex: pip install numpy --proxy https://myproxy#myserver.com:9090

From https://stackoverflow.com/a/33611028/2653663 it looks like it should be
set https_proxy=<domain><username>:<password>#<proxy_server>:<port>
So port instead of ip.

set http_proxy=... and set https_proxy=.... should be enough if the proxy works.
Please run the following command to make sure that it works:
curl https://google.com

Related

Cannot pip install via proxy when on Conda env

I have some weird problem with pip install via proxy.
When I'm in the base Conda environment (/conda) pip install works fine (using proxy: HTTPS_PROXY env variable).
But when I'm switching to another Conda environment, I get proxy errors:
$ conda activate /User/bryan_env
$ pip install xmltodict
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /simple/xmltodict/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /simple/xmltodict/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /simple/xmltodict/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /simple/xmltodict/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /simple/xmltodict/
ERROR: Could not find a version that satisfies the requirement xmltodict
ERROR: No matching distribution found for xmltodict
I've tried to use .condarc as well but had the same errors.
Important to say that this is all in Jupyter shell running in Kuberenetes pod.
Any idea what am I doing wrong here?
I had the same issue and it was solved by reinstalling pip in the environment using:
conda install -c anaconda pip
After that, try your pip install. It worked for me.

'ProxyError('Cannot connect to proxy.', NewConnectionError

While installing any package for python in pycharm. Getting below error:-
Collecting py2neo
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8e2e15780>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/py2neo/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8e2e155f8>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/py2neo/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8e2e15898>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/py2neo/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8e2e154a8>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/py2neo/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8e2e15400>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/py2neo/
Could not find a version that satisfies the requirement py2neo (from versions: )
No matching distribution found for py2neo
I am experiencing exactly the same errors inside my Docker container, behind corporate Proxy. no matter which package I am trying to install.
I could nail it down to the following:
I am getting this error as soon as any proxy env var is set (either https_proxy or HTTPS_PROXY). The curious thing it doesn´t matter if this is the right proxy or not. Also, I experienced, that when one of these vars is set, pip seems to ignore what I pass via the --proxy switch during installation.
I got it working using the following workaround:
making sure that there is neither https_proxy (lowercase), not HTTPS_PROXY (uppercase) environment var is set.
run pip install using the following command
pip3 --proxy=http://<proxyHost>:<proxyPort> install py2neo
While this workaround works for me, I would still be interested to find a resolution for this, as
I am really curious about what´s going there
it is kind of annoying to have to specify the proxy in the command inside of the Dockerfile

Error while installing fuzzywuzzy library in my jupyter notebook

When i am trying to install fuzzywuzzylibrary in my jupyter notebook,
i am getting below error.
Retrying (Retry(total=4, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProxyError('Cannot connect to
proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication
Required',))': /simple/fuzzywuzzy/
Retrying (Retry(total=3, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProxyError('Cannot connect to
proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication
Required',))': /simple/fuzzywuzzy/
Retrying (Retry(total=2, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProxyError('Cannot connect to
proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication
Required',))': /simple/fuzzywuzzy/
Retrying (Retry(total=1, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProxyError('Cannot connect to
proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication
Required',))': /simple/fuzzywuzzy/
Retrying (Retry(total=0, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProxyError('Cannot connect to
proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication
Required',))': /simple/fuzzywuzzy/
Could not find a version that satisfies the requirement fuzzywuzzy (from
versions: )
No matching distribution found for fuzzywuzzy
Could anyone please help me ??
Try this: pip install --proxy https://username:pwd#proxy:host fuzzywuzzy

Pip install Proxy with 403 Forbidden inside of a Dockerfile

I am trying to set up a docker container by using a Dockerfile that is inside of a corporate network behind a proxy.
Each time I am trying to execute the installation of different python packages by running the "pip install" command I am facing the following issue:
Step 9/20 : RUN pip install requests
---> Running in 98d679800849
Collecting requests
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',))': /packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',))': /packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',))': /packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',))': /packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',))': /packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))
My current Dockerfile contains the following commands:
# Base image
FROM python:3.6-slim
ENV http_proxy http://user:pw#server:port/
ENV https_proxy http://user:pw#server:port/
ENV HTTP_PROXY http://user:pw#server:port/
ENV HTTPS_PROXY http://user:pw#server:port/
RUN pip install --upgrade pip #thats working
RUN pip install requests #not working
RUN pip --proxy=http://user:pw#server:port/ install pandas #not working either
I tried several solutions like providing the build argument when executing the build command and passing the proxy settings inside for example. I dont have further clues why its not working for the running the pip command.
Thats even more strange since I am able to pull the base image which had not worked before defining the proxysettings by using the ENV variable. Anyone here that has a clue what causes this problem?

407 Proxy Authentication Required in Windows 8.1

I am trying to install numpy in windows 8.1 using pip install numpy.
It gives following error:
Collecting numpy
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connec
tion broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connectio
n failed: 407 Proxy Authentication Required',))': /simple/numpy/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connec
tion broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connectio
n failed: 407 Proxy Authentication Required',))': /simple/numpy/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connec
tion broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connectio
n failed: 407 Proxy Authentication Required',))': /simple/numpy/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connec
tion broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connectio
n failed: 407 Proxy Authentication Required',))': /simple/numpy/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connec
tion broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connectio
n failed: 407 Proxy Authentication Required',))': /simple/numpy/
Could not find a version that satisfies the requirement numpy (from versions:
)
No matching distribution found for numpy
After referring this I run following command in cmd:
set proxy proxy-server="http=202.141.80.19:3128;https=202.141.80.19:3128"
For authentication purpose I have also tried:
set proxy proxy-server="http=username:password#202.141.80.19:3128;https=username:password#202.141.80.19:3128"
But it did not work.
How do I get rid of this error?
After many attempts this helped me proceed with my work.
set HTTP_PROXY=http://proxy_userid:proxy_password#proxy_ip:proxy_port
set HTTPS_PROXY=http://proxy_userid:proxy_password#proxy_ip:proxy_port

Categories

Resources