ModuleNotFoundError: No module named 'rich.logging' in python

Question:

I have init.py that includes this code and I get the error below the code:

from __future__ import annotations

import logging

from rich.logging import RichHandler

FORMAT = "%(message)s"
logging.basicConfig(
    format=FORMAT, datefmt="[%X] ", handlers=[RichHandler()], level=logging.INFO,
)

from . import ai
from . import cli
from . import clustering
from . import games
from . import poker
from . import terminal
from . import utils

__version__ = "1.0.0rc3"

when I run it I get this error:

>>> import poker_ai
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:apps1poker_aipoker_ai__init__.py", line 5, in <module>
    from rich.logging import RichHandler
ModuleNotFoundError: No module named 'rich.logging'

This is the repo if you need:
https://github.com/fedden/poker_ai

Appreciate helping me to fix this error.

Asked By: Amir

||

Answers:

I noticed the code has an error and needs to be fixed to

from rich.rich.logging import RichHandler

instead of

from rich.logging import RichHandler

this is how the python windows installer installs the code. Nevertheless this leads to another error

ModuleNotFoundError: No module named 'colorama'

which I need to handle.
Appreciate further help for ‘coloroma’

Answered By: Amir

Long time since question asked but I happened upon the same and realized as well as solved most of these errors.

The majority of errors described seem to be missing packages, try installing rich, colorama etc.

Answered By: boohjort
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.