question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pipenv-only TLS issue on macOS

See original GitHub issue

pipenv is failing due to TLS issues on a new High Sierra 10.13.4 system with python 2.7.14 from python.org’s pkg installed. I have updated pip to support the latest TLS.

FYI someone mentioned this issue before but closed their issue because it “resolved itself” without explanation.

$ pip --version
pip 10.0.1 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip (python 2.7)

$ python -c "import ssl; print(ssl.OPENSSL_VERSION)"
OpenSSL 0.9.8zh 14 Jan 2016
$ python -m pipenv.help output

Pipenv version: '11.10.1'

Pipenv location: '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pipenv'

Python location: '/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python'

Other Python installations in PATH:

  • 2.7: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

  • 2.7: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

  • 2.7: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

  • 2.7: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

  • 2.7: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

  • 2.7: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

  • 2.7: /usr/local/bin/python2.7

  • 2.7: /usr/bin/python2.7

  • 2.7.14: /Library/Frameworks/Python.framework/Versions/2.7/bin/python

  • 2.7.14: /Library/Frameworks/Python.framework/Versions/2.7/bin/python

  • 2.7.14: /Library/Frameworks/Python.framework/Versions/2.7/bin/python

  • 2.7.14: /Library/Frameworks/Python.framework/Versions/2.7/bin/python

  • 2.7.14: /Library/Frameworks/Python.framework/Versions/2.7/bin/python

  • 2.7.14: /usr/local/bin/python

  • 2.7.10: /usr/bin/python

  • 2.7.14: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2

  • 2.7.14: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2

  • 2.7.14: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2

  • 2.7.14: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2

  • 2.7.14: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2

  • 2.7.14: /usr/local/bin/python2

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '17.5.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 17.5.0: Fri Apr 13 19:32:32 PDT 2018; root:xnu-4570.51.2~1/RELEASE_X86_64',
 'python_full_version': '2.7.14',
 'python_version': '2.7',
 'sys_platform': 'darwin'}

System environment variables:

  • PYTHONIOENCODING
  • TERM_PROGRAM_VERSION
  • PLAYERGLOBAL_HOME
  • SCALA_HOME
  • LOGNAME
  • USER
  • HOME
  • PS2
  • PATH
  • PS1
  • PS4
  • TERM_PROGRAM
  • LANG
  • TERM
  • SHELL
  • COLORFGBG
  • SHLVL
  • XPC_FLAGS
  • HISTSIZE
  • ITERM_SESSION_ID
  • _
  • MANPATH
  • JBOSS_HOME
  • M2_HOME
  • HISTFILESIZE
  • TERM_SESSION_ID
  • XPC_SERVICE_NAME
  • SSH_AUTH_SOCK
  • DYLD_LIBRARY_PATH
  • Apple_PubSub_Socket_Render
  • PYTHONDONTWRITEBYTECODE
  • ITERM_PROFILE
  • PIP_PYTHON_PATH
  • TMPDIR
  • ANT_HOME
  • LC_COLLATE
  • __CF_USER_TEXT_ENCODING
  • PWD
  • COLORTERM

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/rick/notes/scripts:/Users/rick/bin::/opt/make/4.2.1/bin:/Users/rick/Library/Python/3.6/bin:/Users/rick/Library/Python/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/openssh/7.6p1/bin:/opt/rar/5.2.1/bin:/opt/redis/3.2.8/bin:/opt/node/6.10.0/bin:/Users/rick/.npm-packages/bin:/opt/mongodb/2.4.10/bin:/opt/ffmpeg/3.4-evermeet:/opt/ImageMagick/6.8.8/bin:/opt/apache/flex-sdk/4.14.0/bin:/opt/jq/1.5/bin:/opt/elasticsearch/1.4.3/bin:/opt/kibana/4.1.2/bin:/opt/postgresql/9.6.2/bin:/opt/ruby/2.5.1/bin:/opt/aria2/1.31.0/bin:/opt/phantomjs/2.1.1/bin:/opt/git-lfs/1.5.5/bin:/opt/google-cloud-sdk/143.0.1/bin:/opt/pandoc/1.19.2.1/bin:/opt/autotools/bin:/opt/openssl/1.0.2m/bin:/opt/icu/58.2/bin:/opt/fop/2.2/fop:/opt/wxWidgets/3.0.3/bin:/opt/erlang/20.2/bin:/opt/yaws/1.99/bin:/opt/apache/ant/1.9.4/bin:/opt/maven/3.3.3/bin:/opt/spark/1.2.0/bin:/opt/sbt/0.13.7/bin:/opt/mysql/5.7.17/bin:/opt/xz/5.2.3/bin:/opt/watchman/4.7.0/bin:/opt/pv/1.6.0/bin:/opt/sassc/3.4.2/bin:/opt/cpdf/2.2/bin:/Applications/CMake.app/Contents/bin:/opt/cmark/0.28.3/bin:/opt/cmark-gfm/0.28.0.gfm.11/bin:/opt/p7zip/16.02/bin:/opt/heroku/20170629/bin:/opt/monero/0.11.1.0:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /Users/rick


Expected result
$ pipenv install -r requirements.txt
Creating a virtualenv for this project…
Using /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python (2.7.14) to create virtualenv…
⠋Already using interpreter /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
New python executable in /Users/rick/.local/share/virtualenvs/voice-quickstart-server-python-zVwW_i1A/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /Users/rick/.local/share/virtualenvs/voice-quickstart-server-python-zVwW_i1A
Creating a Pipfile for this project…
Requirements file provided! Importing into Pipfile…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
... sunshine and rainbows ...
Done.
Actual result
$ pipenv install -r requirements.txt
Creating a virtualenv for this project…
Using /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python (2.7.14) to create virtualenv…
⠋Already using interpreter /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
New python executable in /Users/rick/.local/share/virtualenvs/voice-quickstart-server-python-zVwW_i1A/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /Users/rick/.local/share/virtualenvs/voice-quickstart-server-python-zVwW_i1A
Creating a Pipfile for this project…
Requirements file provided! Importing into Pipfile…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
/Library/Python/2.7/lib/python/site-packages/pipenv/vendor/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/rick/Library/Python/2.7/lib/python/site-packages/pipenv/vendor/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/Users/rick/Library/Python/2.7/lib/python/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/itsdangerous/json (Caused by SSLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661)'),))

/Users/rick/Library/Python/2.7/lib/python/site-packages/pipenv/utils.py:1288: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/var/folders/7x/pfyb8v_j13bdvsj9rrgftq8w0000gn/T/pipenv-L14PsE-requirements'>
  warnings.warn(warn_message, ResourceWarning)
Steps to replicate
Flask==0.10.1
Jinja2==2.7.3
MarkupSafe==0.23
Werkzeug==0.9.6
httplib2==0.9
itsdangerous==0.24
six==1.*
twilio==6.10.0
wsgiref==0.1.2
nose
requests
pyjwt
  • run pipenv install -r requirements.txt

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
GregOwencommented, May 29, 2018

For anyone running into this issue, I was able to fix the problem and successfully use pipenv install after doing the following:

  1. Uninstall pipenv
  2. brew install python2 python3
  3. ls /usr/bin/python* (or wherever your system Python is installed)
  4. For each binary in the result of the above ls command, find the corresponding binary that Brew installed (/usr/local/bin/python* for me) and perform ln -sf /path/to/brew/binary /path/to/system/binary (this will overwrite the system binary)

I hope this helps!

0reactions
siowyishengcommented, Jul 25, 2018

Uninstalling and reinstalling with brew install pipenv worked for me. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSL module in Python is not available (on OSX) - Stack Overflow
This started happening after I reinstalled python using brew install . pip is configured with locations that require TLS/SSL, however the ssl ...
Read more >
Mac OS Python 3.6 unable to pip install any package (TLS ...
Coding example for the question Mac OS Python 3.6 unable to pip install any package (TLS/SSL certificate) ... To fix it, I just...
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
macOS has a bug in its locale detection that prevents us from detecting your shell encoding correctly. This can also be an issue...
Read more >
Overcoming TLS Frustrations with Python and macOS Sierra
The problem is largely caused by Python being linked to an older version of the OpenSSL library on any OS versions older than...
Read more >
How to use pipenv to create virtual environments - Scaleway
dev-packages lists the packages required for the project (development environments only); requires specifes the required python version for the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found