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

pip installation with a url for constraint file behind proxy #9307

Open
wushuzh opened this issue Dec 16, 2020 · 5 comments
Open

pip installation with a url for constraint file behind proxy #9307

wushuzh opened this issue Dec 16, 2020 · 5 comments

Comments

@wushuzh
Copy link

wushuzh commented Dec 16, 2020

Environment

  • pip version:
pip 9.0.3 from /root/pip_install_proxy/venv/lib64/python3.6/site-packages (python 3.6)
  • Python version:
Installed Packages
Name         : python36
Version      : 3.6.8
Release      : 2.module_el8.3.0+562+e162826a
Architecture : x86_64
Size         : 13 k
Source       : python36-3.6.8-2.module_el8.3.0+562+e162826a.src.rpm
Repository   : @System
From repo    : AppStream
  • OS:
CentOS Linux release 8.3.2011

Description

There is a virtual env created.
Then I set the proxy variables in the shell session.
Then I activated the venv and launched the following pip install command with a url for constraint file.
But the pip cannot access the constraints file through proxy.

Maybe it's related to #3504

Expected behavior

pip can get the constraint file from given url via proxy and do the installation.

How to Reproduce

  1. Get requirement file from https://opendev.org/openstack/bifrost/raw/branch/master/requirements.txt
  2. Then set proxy variable using export http_proxy=... and export https_proxy=...
  3. Create a venv and activate it
  4. Then run pip -v install -r requirements.txt -c https://releases.openstack.org/constraints/upper/master

Output

# curl -L https://releases.openstack.org/constraints/upper/master
ntlm-auth===1.5.0
voluptuous===0.12.0
chardet===3.0.4
enum-compat===0.0.3
rsa===4.6
restructuredtext-lint===1.3.2
netmiko===3.3.2
sshtunnel===0.3.1
PasteDeploy===2.1.1
typing===3.7.4.3
python-saharaclient===3.3.0
Routes===2.5.1
rtslib-fb===2.1.74
oslo.limit===1.2.1
smmap===3.0.4
confget===2.3.4
XStatic-Angular-Bootstrap===2.5.0.0
WebOb===1.8.6
sphinxcontrib-actdiag===2.0.0
pecan===1.3.3
ryu===4.34
os-api-ref===2.1.0
python-ldap===3.3.1
...
# pip -v install -r requirements.txt -c https://releases.openstack.org/constraints/upper/master 
Looking up "https://releases.openstack.org/constraints/upper/master" in the cache
Returning cached "301 Moved Permanently" response (ignoring date and etag information)
Looking up "https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt" in the cache
No cache entry available
Starting new HTTPS connection (1): opendev.org
Incremented Retry for (url='/openstack/requirements/raw/branch/master/upper-constraints.txt'): Retry(total=4, connect=None, read=None, redirect=None, status=None)
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out',))': /openstack/requirements/raw/branch/master/upper-constraints.txt
Starting new HTTPS connection (2): opendev.org
Incremented Retry for (url='/openstack/requirements/raw/branch/master/upper-constraints.txt'): Retry(total=3, connect=None, read=None, redirect=None, status=None)
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out',))': /openstack/requirements/raw/branch/master/upper-constraints.txt
Starting new HTTPS connection (3): opendev.org
Incremented Retry for (url='/openstack/requirements/raw/branch/master/upper-constraints.txt'): Retry(total=2, connect=None, read=None, redirect=None, status=None)
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out',))': /openstack/requirements/raw/branch/master/upper-constraints.txt
Starting new HTTPS connection (4): opendev.org
Incremented Retry for (url='/openstack/requirements/raw/branch/master/upper-constraints.txt'): Retry(total=1, connect=None, read=None, redirect=None, status=None)
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out',))': /openstack/requirements/raw/branch/master/upper-constraints.txt
Starting new HTTPS connection (5): opendev.org
Incremented Retry for (url='/openstack/requirements/raw/branch/master/upper-constraints.txt'): Retry(total=0, connect=None, read=None, redirect=None, status=None)
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out',))': /openstack/requirements/raw/branch/master/upper-constraints.txt
Starting new HTTPS connection (6): opendev.org
Exception:
Traceback (most recent call last):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 595, in urlopen
    self._prepare_proxy(conn)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 816, in _prepare_proxy
    conn.connect()
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connection.py", line 294, in connect
    self._tunnel()
  File "/usr/lib64/python3.6/http/client.py", line 924, in _tunnel
    (version, code, message) = response._read_status()
  File "/usr/lib64/python3.6/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib64/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 668, in urlopen
    **response_kw)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 668, in urlopen
    **response_kw)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 668, in urlopen
    **response_kw)
  [Previous line repeated 2 more times]
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
pip._vendor.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='opendev.org', port=443): Max retries exceeded with url: /openstack/requirements/raw/branch/master/upper-constraints.txt (Caused by ProxyError('Cannot connect to proxy.', timeout('timed out',)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/commands/install.py", line 334, in run
    wheel_cache
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/basecommand.py", line 269, in populate_requirement_set
    session=session, wheel_cache=wheel_cache):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/req/req_file.py", line 84, in parse_requirements
    filename, comes_from=comes_from, session=session
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/download.py", line 418, in get_file_content
    resp = session.get(url)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/download.py", line 387, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 662, in send
    history = [resp for resp in gen] if allow_redirects else []
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 662, in <listcomp>
    history = [resp for resp in gen] if allow_redirects else []
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 244, in resolve_redirects
    **adapter_kwargs
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 640, in send
    r = adapter.send(request, **kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 502, in send
    raise ProxyError(e, request=request)
pip._vendor.requests.exceptions.ProxyError: HTTPSConnectionPool(host='opendev.org', port=443): Max retries exceeded with url: /openstack/requirements/raw/branch/master/upper-constraints.txt (Caused by ProxyError('Cannot connect to proxy.', timeout('timed out',)))
Looking up "https://pypi.python.org/pypi/pip/json" in the cache
No cache entry available
Starting new HTTPS connection (1): pypi.python.org
There was an error checking the latest version of pip
Traceback (most recent call last):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 595, in urlopen
    self._prepare_proxy(conn)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 816, in _prepare_proxy
    conn.connect()
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connection.py", line 294, in connect
    self._tunnel()
  File "/usr/lib64/python3.6/http/client.py", line 924, in _tunnel
    (version, code, message) = response._read_status()
  File "/usr/lib64/python3.6/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib64/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
pip._vendor.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by ProxyError('Cannot connect to proxy.', timeout('timed out',)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/utils/outdated.py", line 141, in pip_version_check
    headers={"Accept": "application/json"},
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/download.py", line 387, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 640, in send
    r = adapter.send(request, **kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 502, in send
    raise ProxyError(e, request=request)
pip._vendor.requests.exceptions.ProxyError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by ProxyError('Cannot connect to proxy.', timeout('timed out',)))

# curl -L https://pypi.python.org

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="defaultLanguage" content="en">
    <meta name="availableLanguages" content="en, es, fr, ja, pt_BR, uk, el, de, zh_Hans, ru, he">

    

    <title>PyPI · The Python Package Index</title>
    <meta name="description" content="The Python Package Index (PyPI) is a repository of software for the Python programming language.">

    <link rel="stylesheet" href="/static/css/warehouse-ltr.36481e35.css">
    <link rel="stylesheet" href="/static/css/fontawesome.6002a161.css">
    <link rel="stylesheet" href="/static/css/regular.98fbf39a.css">
    <link rel="stylesheet" href="/static/css/solid.c3b5f0b5.css">
    <link rel="stylesheet" href="/static/css/brands.2c303be1.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600,600italic,700,700italic%7CSource+Code+Pro:500">
    <noscript>
      <link rel="stylesheet" href="/static/css/noscript.14e57721.css">
    </noscript>

    

    <link rel="icon" href="/static/images/favicon.6a76275d.ico" type="image/x-icon">

    <link rel="alternate" type="application/rss+xml" title="RSS: 40 latest updates" href="/rss/updates.xml">
    <link rel="alternate" type="application/rss+xml" title="RSS: 40 newest packages" href="/rss/packages.xml">
    

@uranusjr
Copy link
Member

9.0.3 is almost three years old and not maintained for a long time. Do you see this in recent pip versions? The current is 20.3.3.

@uranusjr uranusjr added the S: awaiting response Waiting for a response/more information label Dec 16, 2020
@wushuzh
Copy link
Author

wushuzh commented Dec 21, 2020

Hi, I tried again with a more recent version of pip.

I am not sure it's due to the problem from my proxy or not, I am saying that because although curl can be executed successfully but it takes serveral seconds to response the contents.

What's the default timeout value for pip and what's the default for curl ?

Maybe I should try to update pip timeout value and try again ?

Here is my output.

# pip -v install -r requirements.txt -c https://releases.openstack.org/constraints/upper/master
Using pip 20.3.3 from /root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip (python 3.6)
Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-kl4iof9j
Created temporary directory: /tmp/pip-req-tracker-4cjjjabm
Initialized build tracking at /tmp/pip-req-tracker-4cjjjabm
Created build tracker: /tmp/pip-req-tracker-4cjjjabm
Entered build tracker: /tmp/pip-req-tracker-4cjjjabm
Created temporary directory: /tmp/pip-install-x0o2nk94
Looking up "https://releases.openstack.org/constraints/upper/master" in the cache
Returning cached "301 Moved Permanently" response (ignoring date and etag information)
Looking up "https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt" in the cache
No cache entry available
Starting new HTTPS connection (1): opendev.org:443
Incremented Retry for (url='/openstack/requirements/raw/branch/master/upper-constraints.txt'): Retry(total=4, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out',))': /openstack/requirements/raw/branch/master/upper-constraints.txt
Starting new HTTPS connection (2): opendev.org:443
Incremented Retry for (url='/openstack/requirements/raw/branch/master/upper-constraints.txt'): Retry(total=3, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out',))': /openstack/requirements/raw/branch/master/upper-constraints.txt
Starting new HTTPS connection (3): opendev.org:443
Incremented Retry for (url='/openstack/requirements/raw/branch/master/upper-constraints.txt'): Retry(total=2, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out',))': /openstack/requirements/raw/branch/master/upper-constraints.txt
Starting new HTTPS connection (4): opendev.org:443
Incremented Retry for (url='/openstack/requirements/raw/branch/master/upper-constraints.txt'): Retry(total=1, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out',))': /openstack/requirements/raw/branch/master/upper-constraints.txt
Starting new HTTPS connection (5): opendev.org:443
Incremented Retry for (url='/openstack/requirements/raw/branch/master/upper-constraints.txt'): Retry(total=0, connect=None, read=None, redirect=None, status=None)
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('timed out',))': /openstack/requirements/raw/branch/master/upper-constraints.txt
Starting new HTTPS connection (6): opendev.org:443
ERROR: Could not install packages due to an EnvironmentError.
Traceback (most recent call last):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connection.py", line 366, in connect
    self._tunnel()
  File "/usr/lib64/python3.6/http/client.py", line 924, in _tunnel
    (version, code, message) = response._read_status()
  File "/usr/lib64/python3.6/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib64/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 796, in urlopen
    **response_kw
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 796, in urlopen
    **response_kw
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 796, in urlopen
    **response_kw
  [Previous line repeated 2 more times]
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 756, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/urllib3/util/retry.py", line 573, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
pip._vendor.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='opendev.org', port=443): Max retries exceeded with url: /openstack/requirements/raw/branch/master/upper-constraints.txt (Caused by ProxyError('Cannot connect to proxy.', timeout('timed out',)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_internal/commands/install.py", line 291, in run
    reqs = self.get_requirements(args, options, finder, session)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_internal/cli/req_command.py", line 341, in get_requirements
    session=session):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_internal/req/req_file.py", line 151, in parse_requirements
    for parsed_line in parser.parse(filename, constraint):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_internal/req/req_file.py", line 341, in parse
    for line in self._parse_and_recurse(filename, constraint):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_internal/req/req_file.py", line 346, in _parse_and_recurse
    for line in self._parse_file(filename, constraint):
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_internal/req/req_file.py", line 379, in _parse_file
    _, content = get_file_content(filename, self._session)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_internal/req/req_file.py", line 560, in get_file_content
    resp = session.get(url)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_internal/network/session.py", line 428, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 677, in send
    history = [resp for resp in gen]
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 677, in <listcomp>
    history = [resp for resp in gen]
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 245, in resolve_redirects
    **adapter_kwargs
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/cachecontrol/adapter.py", line 53, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/root/pip_install_proxy/venv/lib64/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 510, in send
    raise ProxyError(e, request=request)
pip._vendor.requests.exceptions.ProxyError: HTTPSConnectionPool(host='opendev.org', port=443): Max retries exceeded with url: /openstack/requirements/raw/branch/master/upper-constraints.txt (Caused by ProxyError('Cannot connect to proxy.', timeout('timed out',)))
Removed build tracker: '/tmp/pip-req-tracker-4cjjjabm'

curl is successful but it takes serveral seconds to get the content.

# curl -L -k https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt
ntlm-auth===1.5.0
voluptuous===0.12.0
chardet===3.0.4
enum-compat===0.0.3
rsa===4.6
restructuredtext-lint===1.3.2
netmiko===3.3.2
sshtunnel===0.3.1
PasteDeploy===2.1.1
typing===3.7.4.3
python-saharaclient===3.3.0
Routes===2.5.1
rtslib-fb===2.1.74
oslo.limit===1.2.1
smmap===3.0.4
confget===2.3.4
XStatic-Angular-Bootstrap===2.5.0.0
WebOb===1.8.6
sphinxcontrib-actdiag===2.0.0
pecan===1.3.3
ryu===4.34
os-api-ref===2.1.0
python-ldap===3.3.1
oslo.concurrency===4.3.1
websocket-client===0.57.0
osprofiler===3.4.0
os-resource-classes===1.0.0
tabulate===0.8.7
python-ironic-inspector-client===4.4.0
lxml===4.6.2
vintage===0.4.1
ntc-templates===1.6.0

@no-response no-response bot removed the S: awaiting response Waiting for a response/more information label Dec 21, 2020
@chrisinmtown
Copy link

chrisinmtown commented Jun 30, 2021

This reads exactly like the problem described in #1805 (that issue is closed to new comments). The proxy setting is used to fetch and install the first few items in the REQUIREMENTS file, then suddenly pip3 abandons/loses the proxy setting and starts going directly to pypi.org and files.pythonhosted.org. In an environment when a proxy is required, those direct requests fail.

Some workarounds are specifying --proxy http://your.proxy:12345 on the command line, setting HTTPS_PROXY environment variable, or both.

I'm using pip version 21.1.2 from behind a Very Large Corporation's proxy, and this problem bedevils me daily. I would be glad to contribute some debugging output if it's helpful.

@uranusjr
Copy link
Member

I don’t understand your diagnosis. The top post says they already set HTTP_PROXY and/or HTTPS_PROXY (depending on your proxy configuration), which is (one of) the recommended configuration, hence the issue. But you categorise it as a workaround. It is not. That (or --proxy) is exactly what you should do.

@chrisinmtown
Copy link

@uranusjr of couse I may have misdiagnosed this. The symptom in #1805 is that when running pip on a list of packages from a requirements file, pip uses the proxy for the first few installs and then abruptly stops using the proxy. Perhaps here it failed on the very first install?

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

No branches or pull requests

3 participants