I'm using QGIS 3.22.0 (Bialowieza)

I'm trying to work with the GHSL-S2 plugin. As far as my research goes, it is important to install the plugin Google Earth Engine. I have an active account with google Earth Engine and I'm following the instruction to import it into QGIS with this technical report. However, when I try to import Earth Engine in QGIS I always get the same error message. Meanwhile, ob the webpage I get the message that the authentification was a success.

import ee
Starting Google Earth Engine Authorization ... - - [11/Nov/2022 15:51:01] "GET /?code=4/0AfgeXvtQoAm0vILGA3qm7sE41n7YcmvCBO_mMdNVcJ44vAuIvJySSQ5_63DC5OCDzcjrkA&scope=https://www.googleapis.com/auth/earthengine%20https://www.googleapis.com/auth/devstorage.full_control%20https://www.googleapis.com/auth/accounts.reauth HTTP/1.1" 200 -
Traceback (most recent call last):
  File "C:\Users\Taani\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 221, in get_persistent_credentials
    return Credentials(None, **oauth.get_credentials_arguments())
  File "C:\Users\Taani\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\oauth.py", line 68, in get_credentials_arguments
    with open(get_credentials_path()) as creds:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Taani/.config/earthengine/credentials'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users/Taani/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 42, in __wrapping_ee_import__
  File "C:\Users\Taani\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\__init__.py", line 127, in Initialize
    credentials = data.get_persistent_credentials()
  File "C:\Users\Taani\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 223, in get_persistent_credentials
    raise ee_exception.EEException(
ee.ee_exception.EEException: Please authorize access to your Earth Engine account by running

earthengine authenticate

in your command line, and then retry.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\urllib\request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\http\client.py", line 1253, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\http\client.py", line 1299, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\http\client.py", line 1248, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\http\client.py", line 1008, in _send_output
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\http\client.py", line 948, in send
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\http\client.py", line 1415, in connect
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\http\client.py", line 919, in connect
    self.sock = self._create_connection(
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\socket.py", line 822, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\socket.py", line 953, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "C:\Users/Taani/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 44, in __wrapping_ee_import__
    if authenticate(ee=_module_):
  File "C:\Users/Taani/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 84, in authenticate
    response = urllib.request.urlopen(ee.oauth.TOKEN_URI, data).read().decode()
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\urllib\request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\urllib\request.py", line 517, in open
    response = self._open(req, data)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\urllib\request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\urllib\request.py", line 494, in _call_chain
    result = func(*args)
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\urllib\request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\urllib\request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>

I dont have much experience with python or command lines, I'm finding it hard to understand how I can get earth engine to work. I only need to to use GHSL.

I have installed Idle Shell in Order to authenticate GEE, however with no success. I'm having trouble finding online any kind of tutorial, and since I havent used Python much, I cannot deduce how to solve my problem.

  • 1
    Did you follow the error message suggestion? earthengine authenticate in your command line, and then retry.
    – aldo_tapia
    Nov 24, 2022 at 11:42

1 Answer 1


Verify that you have the python Earth Engine API installed.

In cmd type: earthengine

If it's not installed, you will see a message saying:

earthengine is not an internal or external command...

To install the API type the following in cmd:

pip install earthengine-api

Then you can try to authenticate using Python

import ee
# Trigger the authentication flow.
# Initialize the library.

This will open a website where you will be able to get the required code

  • I have tried that beforehand with the Idle Shell. However, this was not successfull. The first step is already not working.
    – rtaani
    Nov 24, 2022 at 11:00
  • It looks like you don't have earthengine installed. I will add to the answer the instructions to install it.
    – OscarBau
    Nov 24, 2022 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.