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

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

Related

Failed to establish a new connection in wsl when i use pip install

I want to install flask-sqlalchemy within the virtual environment on my ubuntu subsystem (WSL) on Windows 11, using the following command:
pip install flask-sqlalchemy
however i recieve an error in console window.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ff5c27dff10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask-sqlalchemy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ff5c2620280>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask-sqlalchemy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ff5c2620520>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask-sqlalchemy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ff5c26206d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask-sqlalchemy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ff5c2620880>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask-sqlalchemy/
ERROR: Could not find a version that satisfies the requirement flask-sqlalchemy (from versions: none)
ERROR: No matching distribution found for flask-sqlalchemy
I think it is related with network connection in my Ubuntu subsystem. I try on Standalone Linux system and it seems to be work. How i can solve this issue?
i finnaly resolve my issue. I post below steps to solve this problem.
I checked my fireewall settings. It was not an issue.
i dont use proxy so i skipped the proxy issue.
i checked ping from the console window
ping google.com
it displayed
ping: google.com: Temporary failure in name resolution
I found a solution. Seems like my DNS server can't find an address associated to the URL i am passing. I got errors because the resolv.conf file was not set up in my Ubuntu Subsystem.
solution:
in wsl Ubuntu Linux type commamnd
sudo nano /etc/resolv.conf
add nameserver and save file
nameserver 8.8.8.8

I cant install any packages through pip it shows me error

I cant install any packages through pip it shows me error:-
PS
C:\WINDOWS\system32> pip install virtualenv
Collecting virtualenv
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 0x0423C5D0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))': /simple/virtualenv/
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 0x0423C3B0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))': /simple/virtualenv/
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 0x0423C290>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))': /simple/virtualenv/
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 0x0423C090>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))': /simple/virtualenv/
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 0x0423C7F0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))': /simple/virtualenv/
Could not find a version that satisfies the requirement virtualenv (from versions: )
No matching distribution found for virtualenv
This type of Error occurs while updating the pip.
But can be resolved by using following commands.
step 1:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
step 2:
python3 get-pip.p --force-reinstall
step 3:
Now check the pip version:
pip3 --version
This can happen with older versions of pip. Try to upgrade it with pip install --upgrade pip

pip install package via proxy

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

Unable to download Django 2.0.7 in windows 10

DISCLAIMER - I am new to the world of Django and Python. If the question sounds stupid, please bear with me.
OS - Windows 10
Python Version Installed - 3.7
In the windows command prompt, I am trying the following command to download django on my system.
pip install django
pip3 install django
Collecting django
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/django/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/django/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/django/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/django/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/django/
Could not find a version that satisfies the requirement django (from versions: )
No matching distribution found for django
If anybody could help me out or show some direction that would be great. Thanks in advance.
DISCLAIMER 2 :- This is an office environment and not my personal system so there should be restrictions on the firewall and other such good stuffs.
You can try downloading Django unofficial binaries form https://www.lfd.uci.edu/~gohlke/pythonlibs/ (use ctrl + F to find the package)
and install using
pip install "path to downloaded wheel file"
Edit: Offline installation of Django worked with the OP as he did not like to install the unofficial binaries.
Downloaded pytz from https://pypi.org/project/pytz/#files
And then downloaded Django from https://pypi.org/project/Django/#files
Installed wheel files of pytz first and Django next using pip.
This is because your internet proxy is blocking it. So download the installable(.whl,tz) from the server and copy to your local and install it with
pip install <downloaded file name>

Error in installing Flask using pip command in windows

I tried to install Flask as well as virtualenv using pip command in windows command prompt but below error is showing. How can I fix this?
C:\Users\anupa>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.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x06620E50>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))': /simple/flask/
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 0x06620DF0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))': /simple/flask/
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 0x06620C30>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))': /simple/flask/
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 0x06620E10>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))': /simple/flask/
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 0x06620C90>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))': /simple/flask/
Could not find a version that satisfies the requirement Flask (from versions: )
No matching distribution found for Flask
Try using the pip command,
$ pip install --proxy your_proxy_path Flask

Categories

Resources