Skip to content

macOS 10.11 download failures using "system" python 2.7.10 #134

@jadeallenx

Description

@jadeallenx

Ran into this today, when I was trying to update pythonz - if you're using the Apple-shipped python 2.7.10, the SSL libraries linked here don't support TLS 1.2 so github (and a lot of other HTTPS sites are refusing traffic.)

See this post on the python.org blog for more details

Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib import urlretrieve
>>> urlretrieve("https://github.com/saghul/pythonz/archive/master.tar.gz", "/tmp/test.tgz")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 98, in urlretrieve
    return opener.retrieve(url, filename, reporthook, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 245, in retrieve
    fp = self.open(url, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 213, in open
    return getattr(self, name)(url)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 443, in open_https
    h.endheaders(data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 893, in _send_output
    self.send(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 855, in send
    self.connect()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1274, in connect
    server_hostname=server_hostname)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 579, in __init__
    self.do_handshake()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
IOError: [Errno socket error] [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)
>>> from urllib2 import urlopen
>>> req = urlopen("https://www.howsmyssl.com/a/check")
>>> import json
>>> resp = json.loads(req.readline())
>>> resp['tls_version']
"TLS 1.0"

So what can you do?

  1. Upgrade your mac OS installation
  2. Install python2 or 3 using homebrew and make sure it comes in your path before the system python
  3. Modify $HOME/.pythonz/bin/pythonz to explicitly call a newer python than whatever shows up first in your path. (This is what I did.)

As far as I can tell those are your only viable options. This isn't a "pythonz" issue per se, but it will stop pythonz from working correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions