Skip to main content

Hi. When trying to login to the QGIS Sentinel Hub plugin 2.0, I get a warning at the top of QGIS window:


Python error: An error has occurred while executing Python code: See message log (Python Error) for more details.


The message log is:


2021-11-21T22:03:59 WARNING Traceback (most recent call last):

File “C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\urllib3\connectionpool.py”, line 677, in urlopen

chunked=chunked,

File “C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\urllib3\connectionpool.py”, line 381, in _make_request

self._validate_conn(conn)

File “C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\urllib3\connectionpool.py”, line 976, in validate_conn

conn.connect()

File “C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\urllib3\connection.py”, line 370, in connect

ssl_context=context,

File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\urllib3\util\ssl
.py", line 377, in ssl_wrap_socket

return context.wrap_socket(sock, server_hostname=server_hostname)

File “C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\ssl.py”, line 412, in wrap_socket

session=session

File “C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\ssl.py”, line 850, in _create

self.do_handshake()

File “C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\ssl.py”, line 1108, in do_handshake

self._sslobj.do_handshake()

ssl.SSLCertVerificationError: lSSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)


         During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\urllib3\connectionpool.py", line 725, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info(),2]
File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\urllib3\util\retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='services.sentinel-hub.com', port=443): Max retries exceeded with url: /oauth/token (Caused by SSLError(SSLCertVerificationError(1, 'SSSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Users/J0306784/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SentinelHub\exceptions.py", line 63, in new_action_method
action_method(plugin, *args, **kwargs)
File "C:/Users/J0306784/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SentinelHub\main.py", line 217, in login
configurations = new_manager.get_configurations(reload=True)
File "C:/Users/J0306784/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SentinelHub\sentinelhub\configuration.py", line 49, in get_configurations
result_list = self.client.download(url, session_settings=self.settings).json()
File "C:/Users/J0306784/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SentinelHub\sentinelhub\client.py", line 36, in download
headers = self._prepare_headers(session_settings)
File "C:/Users/J0306784/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SentinelHub\sentinelhub\client.py", line 59, in _prepare_headers
session = self._get_session(session_settings)
File "C:/Users/J0306784/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SentinelHub\sentinelhub\client.py", line 78, in _get_session
client_secret=settings.client_secret
File "C:/Users/J0306784/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SentinelHub\sentinelhub\session.py", line 38, in __init__
_ = self.token
File "C:/Users/J0306784/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SentinelHub\sentinelhub\session.py", line 50, in token
self._token = self._fetch_token()
File "C:/Users/J0306784/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SentinelHub\sentinelhub\session.py", line 76, in _fetch_token
client_secret=self.client_secret
File "C:\Users\J0306784\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\SentinelHub\external\requests_oauthlib-1.3.0-py2.py3-none-any.whl\requests_oauthlib\oauth2_session.py", line 344, in fetch_token
**request_kwargs
File "C:\Users\J0306784\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\SentinelHub\external\requests_oauthlib-1.3.0-py2.py3-none-any.whl\requests_oauthlib\oauth2_session.py", line 516, in request
method, url, headers=headers, data=data, **kwargs
File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\requests\sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\requests\sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='services.sentinel-hub.com', port=443): Max retries exceeded with url: /oauth/token (Caused by SSLError(SSLCertVerificationError(1, 'SSSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)')))

I am running QGIS 3.16.7-Hannover.


Thanks in advance for your help.


Julien

Hi,

According to your stack trace it seems that the main cause is:

Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)'))

This indicates that there is a problem with an SSL certificate on your computer. There was one user that reported the same issue a while ago but for a different Python utility. Here is my answer:

Hi I received your report.html file. The error inside seems to be: HTTPSConnectionPool(host='services.sentinel-hub.com', port=443): Max retries exceeded with url: /oauth/token (Caused by SSLError(SSLCertVerificationError(1, ''SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)'))) According to this I believe the issue is with an SSL certificate on your side and has nothing to do with Sentinel Hub credentials. I…

Reply