intake-xarray icon indicating copy to clipboard operation
intake-xarray copied to clipboard

Module not found error for intake=2.0.1

Open roxyboy opened this issue 1 year ago • 6 comments
trafficstars

Hi intake_xarray developers,

I've encountered an error when the version of intake is 2.0.1 where intake_xarray doesn't seem to recognize intake. When I reverted to intake=0.6.8, everything seemed to work fine again.

roxyboy avatar Feb 26 '24 15:02 roxyboy

Intake >2 is a major rewrite of intake, so you are welcome to pin to an earlier version. However, we still aim for backward compatibility, so if you could please specify in what manner intake is not recognised. Do you have an exception/stack-trace?

martindurant avatar Feb 26 '24 15:02 martindurant

Here is an example that works with intake 0.7 but not 2.0. Is it possible there's an issue with the yaml file itself?

Source:

import intake
print(f'intake version: {intake.__version__}')
import intake_xarray
print(f'intake_xarray version: {intake_xarray.__version__}')
cat_url = 'https://raw.githubusercontent.com/pangeo-data/pangeo-datastore/master/intake-catalogs/ocean.yaml'
cat = intake.open_catalog(cat_url)

Output:

intake version: 2.0.3
intake_xarray version: 0.7.0
Traceback (most recent call last):
  File "/home/local/KHQ/john.tourtellott/projects/pan3d/git/pan3d/example.py", line 7, in <module>
    cat = intake.open_catalog(cat_url)
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/__init__.py", line 184, in open_catalog
    return registry[driver](uri, **kwargs)
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/catalog/local.py", line 613, in __init__
    super(YAMLFileCatalog, self).__init__(**kwargs)
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/catalog/base.py", line 128, in __init__
    self.force_reload()
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/catalog/base.py", line 186, in force_reload
    self._load()
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/catalog/local.py", line 648, in _load
    self.parse(text)
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/catalog/local.py", line 728, in parse
    raise exceptions.ValidationError(
intake.catalog.exceptions.ValidationError: Catalog 'https://raw.githubusercontent.com/pangeo-data/pangeo-datastore/master/intake-catalogs/ocean.yaml' has validation errors:

("missing 'module'", {'module': 'intake_xarray'})

johnkit avatar Mar 06 '24 15:03 johnkit

This should be fixed on intake master, if you wouldn't mind checking

martindurant avatar Mar 06 '24 15:03 martindurant

Yes - I confirmed that intake:master can now read that catalog. Many thanks.

So after loading that catalog, I was expecting to find attributes cat.data, cat.entries, cat.aliases, cat.user_parameters, but they aren't there. I am new to intake so perhaps I misunderstand the user docs?

johnkit avatar Mar 06 '24 16:03 johnkit

This is a V1 catalog, and we don't yet have a conversion utility. However the entries are function I think:

list(cat)  # names of datasets
cat.sea_surface_height.to_dask()  # open one of them

martindurant avatar Mar 06 '24 16:03 martindurant

Oh, right. I was applying v2 docs to V1 catalog. Thanks again. I really appreciate your quick response on this.

johnkit avatar Mar 06 '24 16:03 johnkit