1

I'm trying to access the product added to datacube through Jupyter Notebook. For this, I'm using this demo notebook.

The command import utils.data_cube_utilities.data_access_api as dc_api showing error as

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-16-3b34ea0cb5ec> in <module>
----> 1 import utils.data_cube_utilities.data_access_api as dc_api
      2 api = dc_api.DataAccessApi(config = '/home/localuser/.datacube.conf')
      3 
      4 platform = "LANDSAT-8"
      5 name = "LC08_L2SP"

ModuleNotFoundError: No module named 'utils.data_cube_utilities'

I'm doing a local implementation of Open Data Cube. I've installed postgreSQL and indexed the data locally.

enter image description here

2
  • What environment are you running this? Your own custom datacube install, or an existing implementation, e.g. Digital Earth Australia or Digital Earth Africa? Jul 25 at 10:37
  • @Robbi Bishop-Taylor I have install the datacube. This is a local implementation.
    – Badal
    Jul 26 at 3:02
1

Did you download only that individual notebook and run it separately? If so, I suspect this is because you need to instead clone the entire repository located here: https://github.com/opendatacube/datacube-notebooks

git clone https://github.com/opendatacube/datacube-notebooks.git

Once you have that repo cloned locally, you should be able to run the Demo_Notebook.ipynb notebook from its existing location and all the Python module imports should work correctly. If you still run into problems, try adding the utils directory containing the Python modules you need to the system path:

import sys
sys.path.append('<path_to_utils_directory>')
utils.data_cube_utilities.data_access_api as dc_api

Please note however that some of those notebooks are several years old, and may not work as originally intended. There's a list of more up to date Open Data Cube notebook resources here: https://opendatacube.readthedocs.io/en/latest/user/notebooks.html

1
  • Thank You, I followed these steps. This method should work but didn't work in my case. So after cloning the repository, as the error was in importing data_access_api which is a python file present under datacube-notebooks\utils\data_cube_utilities, I copied the content of that python file directly to the jupyter notebook. data_access_api.py contains the definition a class named DataAccessApi. I created an instance of that class and that worked. This may be not the correct way but as I'm doing just a local installation for learning it's OK for me.
    – Badal
    Jul 27 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.