Pipenv: [Help] after pypi change pipenv is unsuable when behind proxy.

Created on 17 Apr 2018  Â·  6Comments  Â·  Source: pypa/pipenv

after change form pypi to new location, pypi.org, pipenv is fairly unusable when connection is behind the firewall(workplace network).

C:\Users\user\Desktop\ssl_test>pipenv install
Creating a virtualenv for this project.
Using C:\Python27\python.exe (2.7.14) to create virtualenv.
Running virtualenv with interpreter C:\Python27\python.exe
New python executable in C:\Users\user\.virtualenvs\ssl_test-6bhXsA1S\Scripts\python.exe
Installing setuptools, pip, wheel...
  Complete output from command C:\Users\user\.virt...S\Scripts\python.exe - setuptools pip wheel:
  Collecting setuptools
Collecting pip
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_
VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)': /packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py
2.py3-none-any.whl
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_
VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)': /packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py
2.py3-none-any.whl
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_
VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)': /packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py
2.py3-none-any.whl
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_
VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)': /packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py
2.py3-none-any.whl
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_
VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)': /packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py
2.py3-none-any.whl
Exception:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\commands\install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\req\req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\download.py", line 821, in unpack_url
    hashes=hashes
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\download.py", line 659, in unpack_http_url
    hashes)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\download.py", line 853, in _download_http_url
    stream=True,
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\_vendor\requests\sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\_vendor\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\_vendor\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\_vendor\cachecontrol\adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\_vendor\requests\adapters.py", line 506, in send
    raise SSLError(e, request=request)
SSLError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/62/a1/0d452b6901b0157a0134fd27ba89bf9
5a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify fa
iled (_ssl.c:661)'),))
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\virtualenv.py", line 2349, in <module>
    main()
  File "c:\python27\lib\site-packages\virtualenv.py", line 712, in main
    symlink=options.symlink)
  File "c:\python27\lib\site-packages\virtualenv.py", line 953, in create_environment
    download=download,
  File "c:\python27\lib\site-packages\virtualenv.py", line 904, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "c:\python27\lib\site-packages\virtualenv.py", line 796, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command C:\Users\user\.virt...S\Scripts\python.exe - setuptools pip wheel failed with error code 2

Virtualenv location:
Creating a virtualenv for this project.
Using c:\python27\python.exe (2.7.14) to create virtualenv.
Already using interpreter c:\python27\python.exe
New python executable in C:\Users\user\.virtualenvs\ssl_test-6bhXsA1S\Scripts\python.exe
Installing setuptools, pip, wheel...
  Complete output from command C:\Users\user\.virt...S\Scripts\python.exe - setuptools pip wheel:
  Collecting setuptools
Collecting pip
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_
VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)': /packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py
2.py3-none-any.whl
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_
VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)': /packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py
2.py3-none-any.whl
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_
VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)': /packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py
2.py3-none-any.whl
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_
VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)': /packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py
2.py3-none-any.whl
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_
VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),)': /packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py
2.py3-none-any.whl
Exception:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\commands\install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\req\req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\download.py", line 821, in unpack_url
    hashes=hashes
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\download.py", line 659, in unpack_http_url
    hashes)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\download.py", line 853, in _download_http_url
    stream=True,
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\_vendor\requests\sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\_vendor\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\_vendor\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\_vendor\cachecontrol\adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "c:\python27\lib\site-packages\virtualenv_support\pip-9.0.3-py2.py3-none-any.whl\pip\_vendor\requests\adapters.py", line 506, in send
    raise SSLError(e, request=request)
SSLError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/62/a1/0d452b6901b0157a0134fd27ba89bf9
5a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify fa
iled (_ssl.c:661)'),))
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "c:\python27\lib\site-packages\virtualenv.py", line 2349, in <module>
    main()
  File "c:\python27\lib\site-packages\virtualenv.py", line 712, in main
    symlink=options.symlink)
  File "c:\python27\lib\site-packages\virtualenv.py", line 953, in create_environment
    download=download,
  File "c:\python27\lib\site-packages\virtualenv.py", line 904, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "c:\python27\lib\site-packages\virtualenv.py", line 796, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command C:\Users\user\.virt...S\Scripts\python.exe - setuptools pip wheel failed with error code 2

Virtualenv location:
Installing dependencies from Pipfile.lock (36eec0).
  ================================ 6/6 - 00:00:02
To activate this project's virtualenv, run the following:
 $ pipenv shell

C:\Users\user\Desktop\ssl_test>

in a pipenv is there any way to disable SSL check false?

I already try to add custom certificate to certifi, and now requests package does work with providing the custom path but not sure how can do the same for pipenv.

Most helpful comment

it started happening again for me, even with PIP_TRUSTED_HOST=files.python.org,
is there any way to supply ssl certificate to pipenv?

pipenv install flask-marshmallow
Installing flask-marshmallow…
Looking in indexes: https://pypi.python.org/simple
Requirement already satisfied: flask-marshmallow in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (0.9.0)
Requirement already satisfied: six>=1.9.0 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from flask-marshmallow) (1.11.0)
Requirement already satisfied: Flask in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from flask-marshmallow) (1.0.2)
Requirement already satisfied: marshmallow>=2.0.0 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from flask-marshmallow) (2.15.3)
Requirement already satisfied: itsdangerous>=0.24 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from Flask->flask-marshmallow) (0.24)
Requirement already satisfied: Jinja2>=2.10 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from Flask->flask-marshmallow) (2.10)
Requirement already satisfied: click>=5.1 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from Flask->flask-marshmallow) (6.7)
Requirement already satisfied: Werkzeug>=0.14 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from Flask->flask-marshmallow) (0.14.1)
Requirement already satisfied: MarkupSafe>=0.23 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from Jinja2>=2.10->Flask->flask-marshmallow) (1.0)

Adding flask-marshmallow to Pipfile's [packages]…
Pipfile.lock (6aec20) out of date, updating to (b0cf6f)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
or\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\python27\lib\site-packages\pipenv\vendor\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "c:\python27\lib\site-packages\pipenv\vendor\requests\adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /pypi/cachecontrol/json (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

All 6 comments

Does pip work on its own?

In order to make pip work, i have to use --trusted-host files.python.org then and then it will work. and somewhere on the issue tracker i read that pipfile's "verify_ssl" will not work (functionality ignored) either.

Hm this is proxy-related? You can set this as an environment variable, PIP_TRUSTED_HOST=files.python.org -- point release coming out soon should fix this

yes it a case of corporate network. but thank for your suggestion, PIP_TRUSTED_HOST=files.python.org did work for me, closing now,

it started happening again for me, even with PIP_TRUSTED_HOST=files.python.org,
is there any way to supply ssl certificate to pipenv?

pipenv install flask-marshmallow
Installing flask-marshmallow…
Looking in indexes: https://pypi.python.org/simple
Requirement already satisfied: flask-marshmallow in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (0.9.0)
Requirement already satisfied: six>=1.9.0 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from flask-marshmallow) (1.11.0)
Requirement already satisfied: Flask in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from flask-marshmallow) (1.0.2)
Requirement already satisfied: marshmallow>=2.0.0 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from flask-marshmallow) (2.15.3)
Requirement already satisfied: itsdangerous>=0.24 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from Flask->flask-marshmallow) (0.24)
Requirement already satisfied: Jinja2>=2.10 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from Flask->flask-marshmallow) (2.10)
Requirement already satisfied: click>=5.1 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from Flask->flask-marshmallow) (6.7)
Requirement already satisfied: Werkzeug>=0.14 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from Flask->flask-marshmallow) (0.14.1)
Requirement already satisfied: MarkupSafe>=0.23 in c:\cygwin64\home\dshah\.virtualenvs\eco_check-ulezzimx\lib\site-packages (from Jinja2>=2.10->Flask->flask-marshmallow) (1.0)

Adding flask-marshmallow to Pipfile's [packages]…
Pipfile.lock (6aec20) out of date, updating to (b0cf6f)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
or\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\python27\lib\site-packages\pipenv\vendor\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "c:\python27\lib\site-packages\pipenv\vendor\requests\adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /pypi/cachecontrol/json (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

try PIP_TRUSTED_HOST=files.pythonhosted.org instead. *note the additional 'hosted'

Was this page helpful?
0 / 5 - 0 ratings