question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KedroContextError in empty 'kedro new' project: expected `ConfigLoader` is `NoneType`

See original GitHub issue

Description

My fairly new project runs into kedro.framework.context.context.KedroContextError: Expected an istance of "ConfigLoader", got "NoneType" instead. I tried to follow the error, and I believe that the Hooks are not loaded yet, however the logger is already trying to use them.

Since I am trying it on my Work station where I don’t have access to github ( I know, kill me pls) I am typing this out and can’t really copy paste long error messages. Sorry.

I proceded to try it with a completely empty project (kedro new, kedro ipython) which runs into the same issue.

Context

In my new Project I have followed the two tutorials https://kedro.readthedocs.io/en/latest/03_tutorial/04_create_pipelines.html https://kedro.readthedocs.io/en/latest/11_tools_integration/01_pyspark.html

only after which I tried ‘kedro run’, which lead to the Issue.

Steps to Reproduce

  1. kedro --version -> 0.17.1
  2. kedro new
  3. kedro ipython

Expected Result

the session should be able to start.

Actual Result

As I said, no copy paste 😦


with KedroSession.create(....
...
conf_logging = self.get_logging_config()
...
return self._get_config_loader().

the Exception raised is in this function where I added one line of debug:

    def _get_config_loader(self) -> ConfigLoader:
        """A hook for changing the creation of a ConfigLoader instance.
        Returns:
            Instance of `ConfigLoader` created by `register_config_loader` hook.
        Raises:
            KedroContextError: Incorrect ``ConfigLoader`` registered for the project.
        """
        conf_root = settings.CONF_ROOT
        conf_paths = [
            str(self.project_path / conf_root / "base"),
            str(self.project_path / conf_root / self.env),
        ]
        hook_manager = get_hook_manager()
        config_loader = hook_manager.hook.register_config_loader(  # pylint: disable=no-member
            conf_paths=conf_paths, env=self.env, extra_params=self._extra_params,
        )

        # I ADDED THIS:
        print(hook_manager.hook.register_config_loader.get_hookimpls()) --- > []
    
        if not isinstance(config_loader, ConfigLoader):
            raise KedroContextError(
                f"Expected an instance of `ConfigLoader`, "
                f"got `{type(config_loader).__name__}` instead."
            )
        return config_loader

This is why I believe that the hooks are not registered yet.

Your Environment

Include as many relevant details about the environment in which you experienced the bug:

  • Kedro version used (pip show kedro or kedro -V):
  • Python version used (python -V): 3.6
  • Operating system and version: Linux 3.10.0 on Cloudera Workbench 5.xxx

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Vinay1233commented, Apr 9, 2021

I added configure_project(Path(__file__).parent.name) to my main function and works now.

Thanks for your help @MerelTheisenQB!

1reaction
merelchtcommented, Mar 9, 2021

Hi @Spooky-0 , this is a known issue which we will very soon release a fix for. In the meantime we recommend to just roll back to Kedro 0.17.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

KedroContextError in empty 'kedro new' project: expected ...
My fairly new project runs into kedro.framework.context.context.KedroContextError: Expected an istance of "ConfigLoader", got "NoneType" instead ...
Read more >
kedro.framework.context.context — Kedro 0.17.3 documentation
ConfigLoader ``) Raises: KedroContextError: If there is a mismatch between Kedro project version and package version. Args: package_name: Package name for ...
Read more >
kedro.framework.context.context — Kedro 0.18.4 documentation
ConfigLoader ``) Raises: KedroContextError: If there is a mismatch between Kedro project version and package version. Args: package_name: Package name for ...
Read more >
kedro.framework.project — Kedro 0.18.4 documentation
ConfigLoader, # kedro.config.abstract_config. ... instead get a cryptic error message ``Expected an instance of `ConfigLoader`, got `NoneType` instead``.
Read more >
Source code for kedro.framework.cli.utils
2: raise KedroCliError( f"Expected the form of 'load_version' to be ... format of `{param.name}` option: Parameter key " f"cannot be an empty string....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found