elysia icon indicating copy to clipboard operation
elysia copied to clipboard

[Bug] AttributeError: module 'logging' has no attribute 'getLevelNamesMapping'

Open ola-pietka opened this issue 4 months ago • 2 comments

Elysia version

0.2.7

Installation method

pip install elysia-ai

Is the issue occurring in the Elysia package or the Elysia web app?

Elysia web app (using the app via elysia start)

What happened?

When changing any setting on the web app (API keys, clusters, agent instructions, literally anything), I get an error when clicking “Save”

E.g. on agent instruction change:

                    ERROR    Error in /change_config_tree API                                                                      tree_config.py:222
                             ╭──────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮                   
                             │ /Users/olapietka/Projects/rag/.venv/lib/python3.10/site-packages/elysia/api/routes/tree_config.py │                   
                             │ :197 in change_config_tree                                                                        │                   
                             │                                                                                                   │                   
                             │   194 │   │   │   for key in api_keys:                                                            │                   
                             │   195 │   │   │   │   del data.settings[key]                                                      │                   
                             │   196 │   │   │                                                                                   │                   
                             │ ❱ 197 │   │   │   tree.configure(**data.settings)                                                 │                   
                             │   198 │   │                                                                                       │                   
                             │   199 │   │   if data.style is not None:                                                          │                   
                             │   200 │   │   │   tree.change_style(data.style)                                                   │                   
                             │                                                                                                   │                   
                             │ /Users/olapietka/Projects/rag/.venv/lib/python3.10/site-packages/elysia/tree/tree.py:323 in       │                   
                             │ configure                                                                                         │                   
                             │                                                                                                   │                   
                             │    320 │   │   self.settings.SETTINGS_ID = str(uuid.uuid4())                                      │                   
                             │    321 │   │   self._config_modified = True                                                       │                   
                             │    322 │   │   self.tree_data.settings = self.settings                                            │                   
                             │ ❱  323 │   │   self.settings.configure(**kwargs)                                                  │                   
                             │    324 │                                                                                          │                   
                             │    325 │   def change_style(self, style: str) -> None:                                            │                   
                             │    326 │   │   self.tree_data.atlas.style = style                                                 │                   
                             │                                                                                                   │                   
                             │ /Users/olapietka/Projects/rag/.venv/lib/python3.10/site-packages/elysia/config.py:455 in          │                   
                             │ configure                                                                                         │                   
                             │                                                                                                   │                   
                             │   452 │   │   │   │   if "logging_level" in kwargs                                                │                   
                             │   453 │   │   │   │   else kwargs["logger_level"]                                                 │                   
                             │   454 │   │   │   )                                                                               │                   
                             │ ❱ 455 │   │   │   self.LOGGING_LEVEL_INT = logging.getLevelNamesMapping()[self.LOGGING_LEVEL]     │                   
                             │   456 │   │   │   self.logger.setLevel(self.LOGGING_LEVEL)                                        │                   
                             │   457 │   │   │   if "logging_level" in kwargs:                                                   │                   
                             │   458 │   │   │   │   kwargs.pop("logging_level")                                                 │                   
                             ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯                   
                             AttributeError: module 'logging' has no attribute 'getLevelNamesMapping'   

E.g. on OpenAI model change:

 ERROR    Error in /save_config_user API during in-memory update                                                user_config.py:377
                             ╭──────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮                   
                             │ /Users/olapietka/Projects/rag/.venv/lib/python3.10/site-packages/elysia/api/routes/user_config.py │                   
                             │ :364 in save_config_user                                                                          │                   
                             │                                                                                                   │                   
                             │   361 │   │                                                                                       │                   
                             │   362 │   │   # Save the config in memory for this user (Apply step)                              │                   
                             │   363 │   │   try:                                                                                │                   
                             │ ❱ 364 │   │   │   await user_manager.update_config(                                               │                   
                             │   365 │   │   │   │   user_id,                                                                    │                   
                             │   366 │   │   │   │   conversation_id=None,                                                       │                   
                             │   367 │   │   │   │   config_id=config_id,                                                        │                   
                             │                                                                                                   │                   
                             │ /Users/olapietka/Projects/rag/.venv/lib/python3.10/site-packages/elysia/api/services/user.py:117  │                   
                             │ in update_config                                                                                  │                   
                             │                                                                                                   │                   
                             │   114 │   │   branch_initialisation: str | None = None,                                           │                   
                             │   115 │   ):                                                                                      │                   
                             │   116 │   │   local_user = await self.get_user_local(user_id)                                     │                   
                             │ ❱ 117 │   │   local_user["tree_manager"].update_config(                                           │                   
                             │   118 │   │   │   conversation_id,                                                                │                   
                             │   119 │   │   │   config_id,                                                                      │                   
                             │   120 │   │   │   config_name,                                                                    │                   
                             │                                                                                                   │                   
                             │ /Users/olapietka/Projects/rag/.venv/lib/python3.10/site-packages/elysia/api/services/tree.py:84   │                   
                             │ in update_config                                                                                  │                   
                             │                                                                                                   │                   
                             │    81 │   │   │   self.config.name = config_name                                                  │                   
                             │    82 │   │                                                                                       │                   
                             │    83 │   │   if settings is not None:                                                            │                   
                             │ ❱  84 │   │   │   self.configure(conversation_id=conversation_id, replace=True, **settings)       │                   
                             │    85 │   │                                                                                       │                   
                             │    86 │   │   if style is not None:                                                               │                   
                             │    87 │   │   │   self.change_style(style, conversation_id)                                       │                   
                             │                                                                                                   │                   
                             │ /Users/olapietka/Projects/rag/.venv/lib/python3.10/site-packages/elysia/api/services/tree.py:283  │                   
                             │ in configure                                                                                      │                   
                             │                                                                                                   │                   
                             │   280 │   │   │   **kwargs (Any): The keyword arguments to pass to the Settings.configure()       │                   
                             │       method.                                                                                     │                   
                             │   281 │   │   """                                                                                 │                   
                             │   282 │   │   if conversation_id is None:                                                         │                   
                             │ ❱ 283 │   │   │   self.settings.configure(replace=replace, **kwargs)                              │                   
                             │   284 │   │   │   self.config.settings = self.settings                                            │                   
                             │   285 │   │   else:                                                                               │                   
                             │   286 │   │   │   self.get_tree(conversation_id).settings.configure(replace=replace, **kwargs)    │                   
                             │                                                                                                   │                   
                             │ /Users/olapietka/Projects/rag/.venv/lib/python3.10/site-packages/elysia/config.py:455 in          │                   
                             │ configure                                                                                         │                   
                             │                                                                                                   │                   
                             │   452 │   │   │   │   if "logging_level" in kwargs                                                │                   
                             │   453 │   │   │   │   else kwargs["logger_level"]                                                 │                   
                             │   454 │   │   │   )                                                                               │                   
                             │ ❱ 455 │   │   │   self.LOGGING_LEVEL_INT = logging.getLevelNamesMapping()[self.LOGGING_LEVEL]     │                   
                             │   456 │   │   │   self.logger.setLevel(self.LOGGING_LEVEL)                                        │                   
                             │   457 │   │   │   if "logging_level" in kwargs:                                                   │                   
                             │   458 │   │   │   │   kwargs.pop("logging_level")                                                 │                   
                             ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯                   
                             AttributeError: module 'logging' has no attribute 'getLevelNamesMapping'   

Steps to reproduce

  1. start web app
  2. go to settings
  3. change value
  4. click save

Additional context

No response

ola-pietka avatar Oct 23 '25 10:10 ola-pietka

Hi,

i am not that familiar with the repo myself, but i had this error when using python 3.10 When switching to =<3.12 it worked for me

BastianSpatz avatar Oct 23 '25 13:10 BastianSpatz

Ah interesting, I didn't realise that maybe the logging package is different from Python 3.10. I just tested and that is indeed correct.

I'll update the dependency in pyproject.toml to ensure that Elysia is only compatible with Python 3.11 and 3.12 currently.

@ola-pietka Would you be able to check that installing Python 3.11 or 3.12 fixes your issue?

dannyjameswilliams avatar Oct 24 '25 12:10 dannyjameswilliams