Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3.7: Applying the proxy to all parts of pip installation, failing to maintain the proxy variable

Tags:

python

pip

I have the below problem, I am using command

pip install pyinstaller --proxy=http://webdefence.global.blackspider.com:80 --trusted-host=pypi.python.org

The problem I have is the proxy variable is not maintained through the installation process. It no longers has the proxy address when trying to install setuptools. I have tried using HTTP_PROXY and HTTPS_PROXY in my environment variables with no luck. Are there any other ways to set a proxy which will maintain through the pip install?

I have used -vvv to produce more error detail - pasted in at gist.github.com/blaggrob/19e7afcae2b4f1d36139fbf0a88a6651

Collecting pyinstaller
  Using cached https://files.pythonhosted.org/packages/03/32/0e0de593f129bf1d1e77eed562496d154ef4460fd5cecfd78612ef39a0cc/PyInstaller-3.4.tar.gz
  Installing build dependencies ... error
  Complete output from command c:\users\blaggr\appdata\local\programs\python\python37-32\scripts\python.exe -m pip install --ignore-installed --no-user --prefix C:\Users\blaggr\AppData\Local\Temp\pip-build-env-vd3w15r1 --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --trusted-host pypi.python.org -- setuptools wheel:
  Collecting setuptools
    Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
    Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
    Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
    Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
    Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
    Could not find a version that satisfies the requirement setuptools (from versions: )
  No matching distribution found for setuptools
like image 221
Rob Blagg Avatar asked Nov 13 '18 11:11

Rob Blagg


People also ask

How do I pass a proxy to pip?

pip can be configured to connect through a proxy server in various ways: using the --proxy command-line option to specify a proxy in the form scheme://[user:passwd@]proxy.server:port. using proxy in a Configuration Files. by setting the standard environment-variables http_proxy , https_proxy and no_proxy .

How do I enable proxy in Python?

To use a proxy in Python, first import the requests package. Next create a proxies dictionary that defines the HTTP and HTTPS connections. This variable should be a dictionary that maps a protocol to the proxy URL. Additionally, make a url variable set to the webpage you're scraping from.

How do you fix there was an error checking the latest version of pip?

Solve the Warning: There was an error checking the latest version of pip error. The best way to solve this error is to install or update the pip module to the latest version. Before installing the pip module make sure that all the dependencies for this module should be installed.


1 Answers

You may have run into a bug with the new PEP 518 support implementation, where the isolated build environment created to install build-time dependencies is lacking the necessary proxy configuration.

You can bypass the new feature by using --no-build-isolation on the command line, by setting no-build-isolation=no in your configuration file or by setting the PIP_NO_BUILD_ISOLATION=no environment variable (yes, these last two options are counter-intuitive).

This does require that setuptools and wheels then are already installed before you can install pyinstaller.

I've filed a new issue with the pip project to track this, I don't believe it has been reported before.

like image 82
Martijn Pieters Avatar answered Sep 21 '22 17:09

Martijn Pieters