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

local demo fails on MacOS Python3.11 with CERTIFICATE_VERIFY_FAILED #32

Open
peckjon opened this issue Jul 20, 2023 · 0 comments
Open

Comments

@peckjon
Copy link

peckjon commented Jul 20, 2023

For certain out-of-the-box Python installations on MacOS (tested with Python 3.11 on Ventura 13.4.1, and known for Python 3.6 on Sierra), a naive run of the demo streamlit run https://raw.githubusercontent.com/streamlit/demo-uber-nyc-pickups/main/streamlit_app.py will fail, throwing URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed> from /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py line 1391

This is not a problem with the demo per se, but will affect some first user experiences. It occurs because the root certificates shipped with Python are not up-to-date.

Local workaround: run

/Applications/Python\ 3.11/Install\ Certificates.command

Alternative 1: update the demo to ignore SLL failures (only recommended for local testing with known URLs):

ssl._create_default_https_context = ssl._create_unverified_context

Alternative 2: bundle PEM files with the demo and set env (safer, but requires maintenance):

export SSL_CERT_FILE "/some_bundled_path/cacert.pem"
export REQUESTS_CA_BUNDLE = "/some_bundled_path/cacert.pem"
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

1 participant