I need to upgrade pip, and I'm using:
# python get-pip.py --proxy=[user:Password#]10.20.30.1:8082
but I get:
etrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fa5a1e84550>: Failed to establish a new connection: [Errno -2] Name or service not known',))': /simple/pip/
The proxy is working fine.
What type of proxy is it? If it is an NTLM proxy you need to use CNTLM
and then configure it with your proxy details.
Then set your --proxy for PIP to 127.0.0.1:3128
Related
I need to download a package using pip. I ran pip install <package> but got the following error:
[user#server ~]$ pip install sistr_cmd
Collecting sistr_cmd
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0cd90>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0c290>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0c510>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0cf10>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0c190>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
Could not find a version that satisfies the requirement sistr_cmd (from versions: )
No matching distribution found for sistr_cmd
I verified that the source of the problem is the network blocking most sites because I am working behind a proxy (required by the organization). To allow these downloads, I need to compile the list of urls of the source of the downloads and send it to the network admins to unblock.
According to pip documentation (cited and explained in brief in the pip Wikipedia article), “Many packages can be found in the default source for packages and their dependencies — Python Package Index (PyPI)," so I went to the PyPI page for Biopython and found the github repository and the required dependencies for the package. There are also download links on the PyPI page and I want to be sure that all sources for the download are allowed. So does pip install from the original source of a package (the github repository or wherever the original package is hosted), the packages listed in the PyPI page under downloads, or does it search through both?
Thank you in advance for the help.
It appears a network connection, later you may try below:
pip install sistr-cmd
See the difference between - and _ for more info check here
According to user abarnert:
"If you run pip with the --verbose flag, it will show you all the links it considers. Generally speaking, it goes to https://pypi.org/simple/{PACKAGE} first. That page will have links to downloads for wheels and source for all versions that the maintainer has uploaded, and it will look for the appropriate version's wheel by trying its links in order. Usually there is no github repo listed as a source.
If you want to install everything from github (or any other location) that you know, the simplest thing to do is to manually give the repo to pip instead of just the package names. Ideally, install everything you care about that way on a machine that isn't firewalled from most of the internet, build a requirements.txt file (as explained here), then copy that requirements file to your firewalled machine and try to install it."
Running pip install with the --verbose flag shows extensive detail about where the package is being pulled from and about the network connection and traceback.
I am trying to install django using pip but I am not able to do it. Is there any other way to install Django.
I tried like below.
pip install Django
But I got the below error.
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after
connection broken
by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.conne
ction.VerifiedHTTPSConnection object at 0x00000000041C8198>, 'Connection to
pypi.python.org timed out. (connect timeout=15)')': /simple/djando/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after
connection broken by
'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.conne
ction.VerifiedHTTPSConnection object at 0x00000000041C8160>, 'Connection to
pypi.python.org timed out. (connect timeout=15)')': /simple/djando/
Create a virtual environment and install django in it. If that doesn't work then try checking your python version and make sure its 3.4+, then upgrade the pip package, it should work after that.
I was setting up a proxy yesterday on Ubuntu for a test as well as installed some mono libs including new certs for the Linux build of fiddler. After turning off all my proxy settings (such as going to the network settings and turning off the proxy "System wide") I can hit the network normally through all the tools except python. The browsers works fine, I can ping endpoints, I can use wget and curl without any issue, but python's network settings seem screwed up.
Here's the output when I run pip install -U pyopenssl:
$ pip install -U pyopenssl
Collecting pyopenssl
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f89bd58dfd0>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/pyopenssl/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f89bd58db10>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/pyopenssl/
...
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f89bd595f90>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/pyopenssl/
Could not find a version that satisfies the requirement pyopenssl (from versions: )
No matching distribution found for pyopenssl
Running a simple test urllib2 also fails (urllib2.URLError: ):
import urllib2
def internet_on():
try:
urllib2.urlopen('http://216.58.192.142', timeout=1)
print "it worked!"
return True
except urllib2.URLError as err:
print "it did not work"
return False
internet_on()
The requests library also instantly fails in some tools I use:
requests.exceptions.ProxyError: HTTPConnectionPool(host='127.0.0.1', port=8888): Max retries exceeded with url: http://10.30.0.63/ (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4c9c327f90>: Failed to establish a new connection: [Errno 111] Connection refused',)))
I'm guessing python thinks I'm behind a proxy when I'm not anymore. Is there a way to debug or reset python's network configuration?
Fixed the issue. Based on heemayl's comment about an http_proxy variable I checked the environment variables in my bashrc and saw a script had probably added http_proxy and https_proxy, which urllib.getproxies() uses.
Removing those lines fixed the issue. Thanks, heemayl.
Have you tried using the pip --trusted-host pypi.python.org and/or --proxy http://PROXYNAME.com?
I've had similar experiences with pip interacting with system proxies. I imagine pip looks to pypi, hits the proxy, and doesn't find a distribution matching (logically).
The full command would look something like:
pip install -U --trusted-host pypi.python.org --proxy http://PROXYNAME.com pyopenssl
Trusted host helps if your proxy interferes with the certificates.
Let me know if that helps! Also, check env | grep proxy just in case something is wonky with the way you are setting the proxy in the environment.
More generally, check out this question about handling proxies with urllib.
I'm trying to install a Python pip package on Windows 10. Unfortunately, the proxy at my work is giving me trouble.
Things I've tried:
python -m pip install --proxy "http://sam.s1:1234#proxy.det.nsw.edu.au:8080"
python -m pip install --proxy http://sam.s1:1234#proxy.det.nsw.edu.au:8080
& 2. with the protocol changed to https
& 2. omitting the protocol, eg: python -m pip install --proxy sam.s1:1234#proxy.det.nsw.edu.au:8080
set HTTP_PROXY=sam.s1:1234#proxy.det.nsw.edu.au:8080 set HTTPS_PROXY=%HTTP_PROXY% set FTP_PROXY=%HTTP_PROXY%
Editing the proxy address for the HTTP_PROXY env variable in the same way described in steps 1 to 4.
Creating a pip.ini file at %APP_DATA%/pip/ with the following contents:
[global]
proxy = "http://sam.s1:1234#proxy.det.nsw.edu.au:8080"
trusted-host = pypi.python.org
Editing the proxy address in the pip.ini file in the same way described in steps 1 to 4.
They all give me similar errors such as:
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002A6F091B080>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))': /simple/django/
and
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002142813B128>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/django/
and
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/django/
Although sorting out once and for all how to download packages though the proxy would be nice, I'll settle for instructions on any methods that circumvent the proxy entirely, like downloading the package and compiling from source (I usually use Ubuntu, so I have no idea how to do this type of thing on Windows).
Other information:
The proxy is configured via a pac script
The package I'm currently trying to install is Django, but there will probably be others in the future.
I installed pip when I installed Python 3.6.3 (via the checkbox that says something like, do you also want to install pip as well as Python).
I know that pip is grabbing the settings from the .ini file, since I can change the output of $ pip list by setting a value for [list].
I have no idea about the proxy thing, but you can download Python packages from the Python Package Index (PyPI) and install them with pip. There's no need to compile from source in most cases, and definitely not with Django.
You can download Django here and then install it with pip install <path to downloaded package>.
I use a micro ec2 instance with python 2.7.10 installed.
When i try to install djangorestframework with "pip install djangorestframework", it failed and here is the log:
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.python.org timed out. (connect timeout=15)')'
The problem is pip will open a https connection to pyip. Re-check outbound security rule of the instance and add https rule