Python Installation - Datalab on local machine

Overview

This page describes how to create and run a custom Datalab container on your local computer using Docker.

Step 1 - Install Docker

Install the Docker software by following the installation instructions on the Docker website.

Verify your Docker installation is working by opening up a command prompt (terminal) and running the following command:

docker run hello-world
If successful, you should get back a "Hello from Docker!" message with additional information on your Docker installation.

Step 2 - Define a Local Workspace

In a terminal window, run the following commands:

Linux/OSX
export GCP_PROJECT_ID=YOUR_PROJECT_ID
export CONTAINER_IMAGE_NAME=gcr.io/earthengine-project/datalab-ee:latest
export WORKSPACE=${HOME}/workspace/datalab-ee
mkdir -p $WORKSPACE
cd $WORKSPACE
Windows
set "GCP_PROJECT_ID=YOUR_PROJECT_ID"
set "CONTAINER_IMAGE_NAME=gcr.io/earthengine-project/datalab-ee:latest"
set "HOME=%HOMEDRIVE%%HOMEPATH%"
set "WORKSPACE=%HOME%\workspace\datalab-ee"
mkdir "%WORKSPACE%"
cd %WORKSPACE%

Step 3 - Create a container

Create a Datalab+EE container by using the docker run command. The command attaches the local workspace to the container.

Linux/OSX
docker run -it -p "127.0.0.1:8081:8080" -v "$WORKSPACE:/content" -e "PROJECT_ID=$GCP_PROJECT_ID" $CONTAINER_IMAGE_NAME

For troubleshooting issues, see Docker's Get started with Docker for Mac instructions.

Windows
docker run -it -p "127.0.0.1:8081:8080" -v "%WORKSPACE%:/content" -e "PROJECT_ID=%GCP_PROJECT_ID%" %CONTAINER_IMAGE_NAME%

For troubleshooting issues, see Docker's Get started with Docker for Windows instructions.

Authenticating to Earth Engine

In order to successfully run code in Datalab that accesses Earth Engine, you first need to authenticate to Earth Engine. To authenticate from within Datalab, navigate to the /notebooks/docs-earthengine folder and open up the authorize_notebook_server.ipynb notebook. Follow the instructions within the notebook to create and store authentication credentials.

Note that your credentials are stored within your container instance, and will persist if you disconnect from your instance. However, if you delete/remove your Docker container and re-create it, you will need to re-authenticate.

Send feedback about...

Google Earth Engine API