Expected an instance of `ConfigLoader`, got `NoneType` instead

I am trying to start a kedro jupyter notebook using the CLI. When I do, I receive the startup_error: Expected an instance of ConfigLoader, got NoneType instead. I have no idea why this is happening, I have been opening and using jupyter notebooks with no trouble up until now, I’m not sure what has changed to break this.

I have also tried loading the kedro context from inside the terminal. The context seems to load fine using context.load_context(), but whenever I try to call context._get_config_loader(), I get the same below KedroContextError.

I am using kedro version0.17.0

Here is the full stack trace:

Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\colemicm\AppData\Local\Continuum\anaconda3\envs\test\lib\site-packages\kedro\framework\session\session.py”, line 224, in create
session._setup_logging()
File “C:\Users\colemicm\AppData\Local\Continuum\anaconda3\envs\test\lib\site-packages\kedro\framework\session\session.py”, line 242, in _setup_logging
conf_logging = self._get_logging_config()
File “C:\Users\colemicm\AppData\Local\Continuum\anaconda3\envs\test\lib\site-packages\kedro\framework\session\session.py”, line 230, in _get_logging_config
conf_logging = context.config_loader.get(
File “C:\Users\colemicm\AppData\Local\Continuum\anaconda3\envs\test\lib\site-packages\kedro\framework\context\context.py”, line 478, in config_loader
return self._get_config_loader()
File “C:\Users\colemicm\AppData\Local\Continuum\anaconda3\envs\test\lib\site-packages\kedro\framework\context\context.py”, line 461, in _get_config_loader
raise KedroContextError(
kedro.framework.context.context.KedroContextError: Expected an instance of ConfigLoader, got NoneType instead.

Somebody please help, I’ve spent many hours trying to get this working again!

See here:

A bit strange that you have the Issue with 17.0, since for me I had the issue with 17.1 and after going to 17.0 it worked.

However I don’t use Windows, so there is always that.
Perhaps downgrading to 16.x would help you?

1 Like

This does indeed sound like an issue with 0.17.1 rather than 0.17.0. I would double check what version you’ve got installed. Also, do you get the error when you do kedro run or just when you do kedro jupyter?

Assuming you do have 0.17.1 installed, downgrading to 0.17.0 should fix it. Actually this will also be fixed in 0.17.2, coming out soon.

The bug with 0.17.1 is that the ConfigLoader error message is obscuring the actual error (more informative) error message. So, even on 0.17.1, you can try importing settings.py to see what the actual error message should be (e.g. might be an ImportError or a missing package).

2 Likes

Thanks to you both for the advice - I’ve downgraded to 0.17.0, and the ConfigLoader error has gone away. I have a new error now though (note that my project is called bri):

~\repos\bri\envs\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2305 kwargs[‘local_ns’] = sys._getframe(stack_depth).f_locals
2306 with self.builtin_trap:
→ 2307 result = fn(*args, **kwargs)
2308 return result
2309

~\repos\bri\.ipython\profile_default\startup\00-kedro-init.py in reload_kedro(path, line)
     69             "Kedro's ipython session startup script failed:\n%s", str(err)
     70         )
---> 71         raise err
     72 
     73 

~\repos\bri\.ipython\profile_default\startup\00-kedro-init.py in reload_kedro(path, line)
     52             del sys.modules[module]
     53 
---> 54         session = KedroSession.create(metadata.package_name, path)
     55         _activate_session(session, force=True)
     56         logging.debug("Loading the context from %s", str(path))

~\repos\bri\envs\lib\site-packages\kedro\framework\session\session.py in create(cls, package_name, project_path, save_on_close, env, extra_params)
    195         """
    196         # pylint: disable=protected-access
--> 197         session = cls(
    198             package_name=package_name,
    199             project_path=project_path,

~\repos\bri\envs\lib\site-packages\kedro\framework\session\session.py in __init__(self, session_id, package_name, project_path, save_on_close)
    167         self.save_on_close = save_on_close
    168         self._package_name = package_name
--> 169         self._store = self._init_store()
    170 
    171     @classmethod

~\repos\bri\envs\lib\site-packages\kedro\framework\session\session.py in _init_store(self)
    246 
    247     def _init_store(self) -> BaseSessionStore:
--> 248         store_class = _get_project_settings(
    249             self._package_name, "SESSION_STORE_CLASS", BaseSessionStore
    250         )

~\repos\bri\envs\lib\site-packages\kedro\framework\project\settings.py in _get_project_settings(package_name, property_name, default)
     34     package_name: str, property_name: str, default: Any = None
     35 ) -> Any:
---> 36     settings = import_module(f"{package_name}.settings")
     37     return getattr(settings, property_name, default)

~\repos\bri\envs\lib\importlib\__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

~\repos\bri\envs\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)

~\repos\bri\envs\lib\importlib\_bootstrap.py in _find_and_load(name, import_)

~\repos\bri\envs\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)

~\repos\bri\envs\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

~\repos\bri\envs\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)

~\repos\bri\envs\lib\importlib\_bootstrap.py in _find_and_load(name, import_)

~\repos\bri\envs\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'bri'

I appreciate this is now a separate, unrelated error, so I can start a new topic if necessary.

Link to the new topic.

It seems the recently released 0.17.2 still has the problem of the logger being initialized before the hooks? I get the same ConfigLoader error on 0.17.2 as I did on 0.17.1 (in fact the exact same error stack trace)

1 Like