Earth Engine python API installation

1 minute read

Published:

This blog shows you how to install the Google Earth Engine python API and get you ready to work with it.

I am assuming that you already installed the anaconda distribution platform to use python. If not, go to the website, download it and install it.

Subsequent blogs will show you how to use the EE API from a python editor such as Spyder or Jupyter notebook or directly from QGIS.

To install the API, open the anaconda prompt as administrator, copy the following line and paste it there (obtained from here):

conda install -c conda-forge earthengine-api

It should look something like this:

img

Once the installation is completed, open your preferred python editor, Spyder or Jupyter notebook, open a new file, type and run the following lines of the code:

import ee
ee.Initialize()

Because we have not authenticated our credentials, it will rise the following error:

img

In the anaconda command prompt type what the error is suggesting: earthengine authenticate

img

It will automatically direct you to the mail you used to create your EE account for you to provide access to it:

img

Click in your mail and authorize the data access. This will generate a verification code and show you a window like this one:

img

Copy the link and paste it in the command prompt and hit enter:

img

Try again in spyder or Jupyter to import ee and initialize it as before and it should run without problems.