Accessing DE Africa Data and Functionality via Local Environmentsο
Directly accessing Digital Earth Africa (DE Africa) data in a local environment also provides significant advantages, including the flexibility to configure compute resources on your own machine and the ability to integrate DE Africa datasets with user-generated or third-party data. Beyond the DE Africa Sandbox, users can install Python locally and run DE Africa workflows in environments such as Jupyter Notebook, JupyterLab, or even Python IDLE. For more advanced applications, DE Africa workflows can also be integrated into Python-based web services such as Django or Flask, enabling the development of interactive dashboards, APIs, and decision-support tools. This approach gives users full control over package installation, storage, and processing while extending DE Africa capabilities into web and operational systems.
Getting Started in a Local Environmentο
Before you can use DE Africa Direct Access locally, make sure the necessary software is installed.
Using Anaconda is recommended because it simplifies environment management and brings most required packages into one place.
1. Install Anacondaο
After installation, open your Anaconda terminal (Command Prompt on Windows, Terminal on macOS/Linux) and create a new environment:
conda create -n deafrica_env python=3.12
conda activate deafrica_env
2. Install packages into the conda environmentο
We will install required packages using conda in small batches to manage the memory footprint of the installation tasks and simplify environment solving. To do this, procees through the following commands in the Anaconda terminal.
2.1 Begin with core geospatial packagesο
conda install -c conda-forge gdal geopandas rasterio fiona pyproj shapely
2.2 Jupyter and plottingο
conda install -c conda-forge ipykernel matplotlib session-info jupyterlab
2.3 ODC & STACο
conda install -c conda-forge odc-stac odc-algo pystac
2.4 OSMnxο
conda install -c conda-forge osmnx
2.5 xarrayο
conda install -c conda-forge xarray
3. Open JupyterLabο
Run the following in your Anaconda terminal:
jupyter lab
4. Start with DE Africa direct access notebooksο
Navigate to DE Africa Loading Demonstration notebook and upload it into your newly created Jupyter environment to try running it. Alternatively, you could also clone the direct access repository into a local directory youβd like to use.
Once youβve confirmed that the loading demonstration notebook is working as expected, you can experiment with other notebooks.
Selecting the Kernel in Jupyter Notebookο
When you open a notebook in Jupyter Notebook, you need to make sure it is using the correct kernel (the Python environment where you installed your DE Africa packages).
Steps to Select the Kernel:ο
Open Jupyter Notebook by running in your terminal:
jupyter notebookFrom the Jupyter interface, open the notebook you want to run.
Go to the top menu bar and select: Kernel β Change kernel β Python (deafrica_env) (or the name of the environment you created).
The notebook will now run using that environment, with access to the installed DE Africa packages.
β οΈ Tip: If you donβt see your environment listed, make sure you have installed the kernel spec with:
pip install ipykernel
python -m ipykernel install --user --name=deafrica_env --display-name "Python (deafrica_env)"
Then restart Jupyter Notebook and check again under Kernel β Change kernel
hdstats build error (Windows/macOS/Linux)ο
Symptom note: Failed building wheel for hdstats ERROR: Failed to build installable wheels for some pyproject.toml based projects (hdstats)
β Hereβs how to fix it:
π§ Step 1: Install Microsoft C++ Build Tools
Go to this link: π Visual Studio
Step 2: Click Download Build Tools
Step 3: When the installer launches:
Select βC++ build toolsβ
Make sure βWindows 10 SDKβ or βWindows 11 SDKβ is also checked
Click Install
Once installed, restart your system (recommended)
Local Environment vs Cube-in-a-Boxο
Running DE Africa Direct Access in a local environment (e.g., installing Python and using Jupyter Notebook or JupyterLab) is different from using Cube-in-a-Box.
In a local setup, you install the necessary Python packages and run notebooks directly on your own machine. This gives you flexibility and control, but some ODC core functionalities (e.g.,
dc.load) may not be fully available without additional setup.Cube-in-a-Box, on the other hand, comes prepackaged with a complete Open Data Cube (ODC) environment, fully configured inside a Docker container. This setup includes all ODC core functionality out-of-the-box and is designed for users who want a ready-to-use, fully featured data cube environment.
π If you want more information on Cube-in-a-Box, check it here: Cube-in-a-Box Documentation
Accessing DE Africa Tools in a Local Environmentο
Examples of available functions include:
deafrica_display_mapfor interactive map visualization.deafrica_rgbplotting functions for quick rendering of satellite imagery.calculate_indicesfor computing vegetation, water, and other spectral indices.xr_rasterizefor converting vector data to raster grids.
As demonstrated in the loading notebook β and other example notebooks β these functions run effectively in local environments, making it possible to replicate Sandbox workflows while maintaining full control over your compute resources, storage, and package management.
β οΈ Note: Local environments do not come preconfigured with a full ODC core setup (unlike Cube-in-a-Box or the Sandbox).
Functions that depend on ODC (e.g.,
dc.loadandload_ard) will not work without additional configuration.However, most functions that rely on common Python libraries such as xarray, geopandas, and scipy are fully supported and run without issue.
Local environments are ideal for users who want full customization, offline control, and the flexibility to integrate DE Africa workflows into larger applications while still benefiting from the majority of DE Africa tools outside the Sandbox.
Conclusionο
Using DE Africa Direct Access in a local environment such as Python with Jupyter Notebook, JupyterLab, or Python IDLE provides users with flexibility beyond the Sandbox. Moreover, the integration of DE Africa workflows into Python web frameworks like Django or Flask opens up opportunities to build interactive dashboards, web applications, and decision-support tools. While certain ODC-dependent workflows may require additional setup, most DE Africa tools and functions run effectively in these environments. This versatility enables researchers, developers, and institutions to create reproducible, scalable, and operational workflows, combining DE Africa datasets with other sources to support innovation and real-world decision-making.
π‘ Feedbackο
π Looking Aheadο
The DE Africa team will continue to improve these tools and services to make it easier for users to flexibly access, analyze, and integrate data in the environments of their choice.