Could not fetch URL https://pypi.org … There was a problem confirming the ssl certificate.

// Full error message
Could not fetch URL https://pypi.org/simple/autopep8/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='some.host.net', port=444): Max retries exceeded with url: /?cfru=aHR0cHM6Ly9weXBpLm9yZy9zaW1wbGUvYXV0b3BlcDgv (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))) - skipping

// This could mean there is no local certificate to read from. See this post

Could not install packages due to an EnvironmentError [Error 13] Permission denied:

// error message when installing a pip package
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'C:\\Python38\\Lib\\site-packages\\__pycache__\\pycodestyle.cpython-38.pyc'
Consider using the `--user` option or check the permissions.

// just add --user to the command. ex:
python -m pip install autopep8 --user --trusted-host files.pythonhosted.org --trusted-host pypi.org

Call API from Python

import requests
import urllib3

# suppress the HTTPS warnings in terminal
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

# BEGIN
session = requests.Session()
session.verify = False

url = "https://some.url.com?param1=something&param2=something"
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'}

# call the HTTP endpoint
httpResult = session.get(url, headers=headers)
print(httpResult.text)

# some extra details
elapsedSeconds = httpResult.elapsed.total_seconds()
statusCode = httpResult.status_code

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)’),)’: /simple/pylint/ >>>>>>>> Could not fetch URL https://pypi.python.org/simple/setuptools/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=’pypi.python.org’, port=443): Max retries exceeded with url: /simple/setuptools/ (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)’),)) – skipping



// add the following flag to the pip command:

--trusted-host files.pythonhosted.org --trusted-host pypi.org

// or wherever the error indicates a problem in

<error message>... HTTPSConnectionPool(host='pypi.python.org', port=443)

Install GPIO Python library

//Install pip:
sudo apt-get install python3-pip

// Install necessary libraries

//Option1: From text file
python3 -m pip install -r pip-commands.txt

// file contents
setuptools
RPi.GPIO
gpiozero
RPIO
pigpio

//Option2:
python3 -m pip install setuptools
python3 -m pip install RPi.GPIO
python3 -m pip install gpiozero
python3 -m pip install RPIO
python3 -m pip install pigpio