Setting up Google Earth Engine API in local Python Notebook

July 31, 2025
google earth engine
This is a guide on how to setup Google earth engine API to be used in local python environment. Here we can see how to create new project, Give proper access and do authentication in python
Setting up Google Earth Engine API in local Python Notebook

Google Earth Engine has been amazing tool for so many years for researchers, industry experts to access Petabytes worth of datasets along with lightning fast processing speed in google cloud ecosystem. One of the benefits of using GEE is that it's free for individuals who are working on non-commerical or reasearch oritented products. 

In this blog, we'll explore the steps to get your GEE account setup and importing in local python environment.

setting up account to use google earth engine

open your browser and go to https://earthengine.google.com/ , then click on `Get Started` and use your gmail account 

Click on the box next to Google Cloud logo in navbar which will open modal showing all existing project, click on New Project

Given name to the new project and then click on Create

Once created , you can select the name of newly created project either from box in navbar or by clicking on select project from notification bar

Fill out form for See if you are eligible for noncommercial use

My answers are as follows

  • Select your organization type - other
  • Check noncommercial eligibility
    • Which of the following best describes your use case?  - Individual research
    • lease provide more info about how you will be using Earth Engine  - check satellite data, understand more on it 
  • Describe your work
    • check box - Adaptation
    • Will you use Earth Engine for any of the following?  - Agriculture
  • Register

 

After this, you'll see screen to enable Google Earth Engine API, make sure to click on enable.

Once everything is done, click on Continue 

Setup Python

Create new virtualenv in your machine in desired directory

python3 -m venv env

activate virtual env and installed required packages

# Activate Virtualenv
source env/bin/activate

# Install necessary packaged

pip install notebook earthengine-api --upgrade

Once done, create new file e.g. gee.ipynb , and put following code in file

import ee
ee.Authenticate()

After you run the cell, it will take you on browser to get token

here switch project if needed and click on Generate Token

If browser does not open, check your notebook, where you might find a link.

Simply copy the link and paste in browser, this will then confirm your gmail account . If you see dialog box stating Google hasn’t verified this app , It is fine, please click on Continue

After this, give permission to access Google Drive and other required google products

Finally, you'll see a screen with your Authentication key, which you can copy

and then paste in the code editor and hit Enter to run the code

 

After this you can put following code in the python notebook and run the cell 

ee.Initialize(project='mygee-project')
print(ee.String('Hello from the Earth Engine servers!').getInfo())

If your notebook prints the string, it means your setup is done successfully!