In [ ]:
import ee
Next, try to initialize the ee
Python package.
In [ ]:
try:
ee.Initialize()
print('The Earth Engine package initialized successfully!')
except ee.EEException as e:
print('The Earth Engine package failed to initialize!')
except:
print("Unexpected error:", sys.exc_info()[0])
raise
If the initialization succeeded, you can stop here. Congratulations! If not, continue on below...
If the initialization process failed, you will need to authenticate the Jupyter Notebook server so that it can communicate with the Earth Engine servers. You can initiate the authentication process by running the following command.
Note that earthengine authenticate
is a system command (rather than a Python command), and the cell uses the %%bash cell magic in the first line of the cell to indicate that the cell contents should be executed using a bash shell.
In [ ]:
%%bash
earthengine authenticate --quiet
Once you have obtained an authorization code from the previous step, paste the code into the following cell and run it.
In [ ]:
%%bash
earthengine authenticate --authorization-code=PLACE_AUTH_CODE_HERE
In [ ]:
%%bash
rm ~/.config/earthengine