Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'function' object has no attribute 'implementation' #38

Closed
leotizzei opened this issue Mar 27, 2023 · 2 comments · Fixed by #39
Closed

AttributeError: 'function' object has no attribute 'implementation' #38

leotizzei opened this issue Mar 27, 2023 · 2 comments · Fixed by #39

Comments

@leotizzei
Copy link

Hi everyone,

I've tried to execute the Minibackend notebook, but I've got the following error when trying to import a module from openeo_processes_dask

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[5], line 4
      2 import inspect
      3 from openeo_pg_parser_networkx import ProcessRegistry
----> 4 from openeo_processes_dask.core import process
      6 process_registry = ProcessRegistry(wrap_funcs=[process])
      8 # Import these pre-defined processes from openeo_processes_dask and register them into registry

ModuleNotFoundError: No module named 'openeo_processes_dask.core'

I'm using the openeo-processes-dask version 2023.3.2. If I replace from openeo_processes_dask.core import process by from openeo_processes_dask.process_implementations.core import process then the process function is imported correctly, but another exception is raised:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[7], line 19
     10 processes_from_module = [
     11     func
     12     for _, func in inspect.getmembers(
   (...)
     15     )
     16 ]
     18 for p in processes_from_module:
---> 19     process_registry[p.__name__] = p
     21 # I/O processes aren't generic (yet), therefore have to custom define those. 
     22 def load_collection(id, spatial_extent, temporal_extent, bands = [], properties = {}, **kwargs):
     23     # No generic implementation available, so need to implement locally!

File ~/Projects/Orgs/Open-EO/openeo-pg-parser-networkx/openeo_pg_parser_networkx/process_registry.py:49, in ProcessRegistry.__setitem__(self, key, process)
     46 def __setitem__(self, key, process: Process):
     47     t_key = self._keytransform(key)
---> 49     if process.implementation is not None:
     50         decorated_callable = process.implementation
     51         for wrap_f in self.wrap_funcs:

AttributeError: 'function' object has no attribute 'implementation'

Am I doing something wrong or is there a bug in some of these libs? Please let me know if anything is required to reproduce this error. Thanks!

@clausmichele
Copy link
Member

@LukeWeidenwalker I am having the same issue with the latest version of the packages!

@LukeWeidenwalker
Copy link
Contributor

Hey both, thanks for raising this - apologies, I forgot to update the example notebook with the latest changes, this has now been fixed.

I've also created #40 to look into adding the notebooks to CI so this doesn't happen again 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants