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

SSL: CERTIFICATE_VERIFY_FAILED - certificate verify failed #84

Closed
GabiGIS opened this issue Jul 31, 2020 · 13 comments
Closed

SSL: CERTIFICATE_VERIFY_FAILED - certificate verify failed #84

GabiGIS opened this issue Jul 31, 2020 · 13 comments

Comments

@GabiGIS
Copy link

GabiGIS commented Jul 31, 2020

  • rgee version: 1.0.1
  • R version: 4.0.2
  • Operating System: Mac Catalina

I have tried to install library(rgee) and when run :

ee_Initialize()

asks me to allow the permission from a pop up window at web browser of GEE and I allowed and gives me a code which copy and pasted in the Rstudio pop up window

image copy

then I got the following error message:

cpo

What could be the problem? and how can I complete the installation of rgee?

Thanks a lot.
Regards,

@csaybar
Copy link
Collaborator

csaybar commented Jul 31, 2020

@csaybar csaybar changed the title Question on installation of gee SSL: CERTIFICATE_VERIFY_FAILED - certificate verify failed Jul 31, 2020
@GabiGIS
Copy link
Author

GabiGIS commented Jul 31, 2020

Dear Cesar,
Thanks for your response.
Yes, I do have a GEE account.
Actually none of the suggestions solved the problem.
What could be the solution?
Thanks a lot.
Kind regards,
Gabriel

@csaybar
Copy link
Collaborator

csaybar commented Jul 31, 2020

It seems to be a bug in Python 3.6. https://bugs.python.org/issue35941. conda-forge/python-feedstock#267. Upgrade to Python 3.8 solve the problem. Let me know if the problem persist after the upgrade.

@GabiGIS
Copy link
Author

GabiGIS commented Jul 31, 2020

I have python 3.8

Python
and the error persists
maybe this can help to understand....

console

also python from R:

PytonFromR

thanks a lot again
Regards

@csaybar
Copy link
Collaborator

csaybar commented Jul 31, 2020

Just to confirm what Python version is reading reticulate. Please, run the follows and attached the results
NOTE: Restart your R session before running the code below

library(reticulate)
sys <- import("sys")
sys$version

This is a known issue (SSL failed on Mac OSx). Can you confirm that Python also fail?

import ee
ee.Initialize()

@GabiGIS
Copy link
Author

GabiGIS commented Jul 31, 2020

Hello I tried and this were the results

reticul

What should you recommend to do?
Thanks a lot.
Gabriel

@GabiGIS
Copy link
Author

GabiGIS commented Jul 31, 2020

yes python also fail

phyt

@GabiGIS
Copy link
Author

GabiGIS commented Aug 1, 2020

Hello I tried in Windows and got the following error

windows

What could be the problem?
Thanks a lot
Gabriel

@csaybar
Copy link
Collaborator

csaybar commented Aug 3, 2020

The issue was closed because it was solved here.

@csaybar csaybar closed this as completed Aug 3, 2020
@serbinsh
Copy link

I am having the same problem with Python 3.8 on my Mac

Enter Earth Engine Authentication: 
 Error in py_call_impl(callable, dots$args, dots$keywords) : 
  URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)> 

I have a GEE account as well. I cant see the solution as I don't have access...any ideas?

@serbinsh
Copy link

Some more hacking

python3.7 -m pip install earthengine-api --upgrade --upgrade-strategy only-if-needed mypackage

Python 3.7.4 (v3.7.4:e09359112e, Jul  8 2019, 14:54:52)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ee
>>> ee.Authenticate()
To authorize access needed by Earth Engine, open the following URL in a web browser and follow the instructions. If the web browser does not start automatically, please manually browse the URL below.

    https://accounts.google.com/o/oauth2/auth?client_id=517222506229-vsmmajv00ul0bs7p89v5m89qs8eb9359.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fearthengine+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdevstorage.full_control&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&code_challenge=3_EueygsUL2p5WMASogG4k7ZX1990Kn1ZRv9ersBrHc&code_challenge_method=S256

The authorization workflow will generate a code, which you should paste in the box below.
Enter verification code: 
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1414, in connect
    server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ee/__init__.py", line 89, in Authenticate
    oauth.authenticate(authorization_code, quiet, code_verifier)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ee/oauth.py", line 235, in authenticate
    _obtain_and_write_token(None, code_verifier)  # Will prompt for auth_code.
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ee/oauth.py", line 141, in _obtain_and_write_token
    token = request_token(auth_code.strip(), code_verifier)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ee/oauth.py", line 86, in request_token
    parse.urlencode(request_args).encode()).read().decode()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)>
>>>

@spoonerf
Copy link

I am having the same issue as @serbinsh, using Python 3.8 on Mac Big Sur. Is there a workaround for this issue?

@csaybar
Copy link
Collaborator

csaybar commented Jun 30, 2021

Hi @spoonerf can you share more information about your system.

  • Python (reticulate) configuration.
  • rgee version.

We would love to help you with your issue :). Please open a new issue, this one was made in an very early version on rgee

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

4 participants