Installation fails with SSL cert error on Mac when piped to python3
See original GitHub issue- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: MacOS Mojave (10.14.6)
- Poetry version: latest
- Link of a Gist with the contents of your pyproject.toml file: N/A
Issue
I have python 3.6.8 installed directly from python.org on my Mac. If I pipe the install script from poetry into python3
then it fails with an SSL certificate error. Piping instead to python
(default 2.7 version provided by Apple) will install just fine.
➜ pip --version
pip 20.0.2 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip (python 3.6)
➜ python3 --version
Python 3.6.8
➜ python --version
Python 2.7.10
➜ brew list | grep "openssl"
openssl
openssl@1.1
And here is the output when piped to python3
:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 817, in __init__
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 958, in <module>
File "<stdin>", line 934, in main
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
CERTIFICATE_VERIFY_FAILED error with python3 on macOS ...
It's looking into /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/etc/ssl , which doesn't exist.
Read more >Improve error message for SSL - Discussions on Python.org
I propose to clarify the SSL: CERTIFICATE_VERIFY_FAILED error message on macOS to encourage users to install the appropriate certificates ...
Read more >Exploring HTTPS With Python - Real Python
In this tutorial, you'll gain a working knowledge of the various factors that combine to keep communications over the Internet safe.
Read more >Server SSL certificate verification - HTTPie 3.2.1 (latest) docs
In a situation when piping data via stdin is not convenient (for example, when generating API docs examples), you can specify the raw...
Read more >how to download the ssl certificate from a website?
2>/dev/null silences errors (optional), we can pass the whole output into the x509 parser, specifying /dev/stdin to use the shell pipe as the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bdmayes reminds me of https://bugs.python.org/issue28150 - this might be a side-effect of your python3.6 install.
You could test if this is the issue like so:
If it is, can you see if one of the following fixes the issue?
python3 -m pip install --upgrade certifi
open /Applications/Python\ 3.6/Install\ Certificates.command
Yeah thanks @abn. I found https://github.com/python-poetry/poetry/pull/307 which suggests I need http-basic. I’m trying to install from a private repo, not publish to it for what it’s worth. But I still don’t know what’s up with the keychain and python3. Using 2.7 seems to interface with it just fine. And grpcio seems to be my problematic package that’s bringing in enum34 so I’m just going to install the latest version (1.27.2) since it’s apparently fixed since 1.20.0. Hopefully nothing will break in my app. If it does, I’ll install the old version and
pip uninstall enum34
I guess. Thanks again!