0

This is not a duplicate. I've read every response there is online.

Any time I try to connect to a website through the terminal I get an error. Many solutions say to try installing certifi first and then attempting, but I can't do that either because then I'd have to connect to https://pypi.python.org/simple/certifi/. I've also tried --trusted-hostbut I still receive an error.

Here is the error if I try to run the Install Certificates.command in the Python 3.6 folder:

/Applications/Python\ 3.6/Install\ Certificates.command ; exit; -- pip install --upgrade certifi Collecting certifi Could not fetch URL https://pypi.python.org/simple/certifi/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777) - skipping Could not find a version that satisfies the requirement certifi (from versions: ) No matching distribution found for certifi Traceback (most recent call last): File "<stdin>", line 44, in <module> File "<stdin>", line 25, in main File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 291, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6', '-E', '-s', '-m', 'pip', 'install', '--upgrade', 'certifi']' returned non-zero exit status 1. logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. [Process completed] 

I also get the SSL error if I try to use url lib to connect in a python doc and then attempt to run the python doc in the terminal. Let me also mention this is a brand new issue. I ran the same script yesterday and it worked fine.

Versions:

Python 3.6 numpy==1.13.3 ortools==6.6.4656 pandas==0.21.0 protobuf==3.5.0.post1 python-dateutil==2.6.1 pytz==2017.3 six==1.11.0 OpenSSH_7.4p1, LibreSSL 2.5.0 

1 Answer 1

2

Add Below lines in your script and execute the script. Might be it will solve your issue.

import ssl ssl._create_default_https_context = ssl._create_unverified_context 
Sign up to request clarification or add additional context in comments.

4 Comments

That worked! Can you explain a little what that does? Also is there a way to get this to work in the terminal for things like installing packages?
When your requests verifies SSL certificates for HTTPS requests, just like a web browser. By default, SSL verification is enabled, and Requests will throw a SSLError if it's unable to verify the certificate.
Ok. Any thought on getting it to work in the terminal? If I try to run pip3 install certifi I will still get the same error.
This is extremely dangerous as it disables all network security in your program. Don't do it!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.