SSL certificate error when using Pip install on Raspberry

Asked

Viewed 112 times

-1

I am trying to install the opencv library to use it in a project on a Raspberry device with Raspbian and when using the Pip command I get the following error:

(venv) pi@raspberrypi:~/teste $ pip install opencv-python
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting opencv-python
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate is not yet valid (_ssl.c:1056)'))': /simple/opencv-python/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate is not yet valid (_ssl.c:1056)'))': /simple/opencv-python/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate is not yet valid (_ssl.c:1056)'))': /simple/opencv-python/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate is not yet valid (_ssl.c:1056)'))': /simple/opencv-python/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate is not yet valid (_ssl.c:1056)'))': /simple/opencv-python/
  Could not find a version that satisfies the requirement opencv-python (from versions: )
No matching distribution found for opencv-python

After doing some research I realized that the error may be caused by the incorrect date and time on the device, as I have no domain in the use of Raspbian, help to set date and time will be welcome. If this is a possible solution.

1 answer

0

The link used by Pip https://www.piwheels.org/simple appears to be recent (used on 17/04/2020) and the safety certificate used by it seems not yet to be recognized with reliable. To circumvent this security check just do as in the example:

pip install picamera --trusted-host www.piwheels.org

Browser other questions tagged

You are not signed in. Login or sign up in order to post.