MaartenGr / MaartenGr/KeyBERT

cannot import name 'OrderedDict' from 'typing_extensions'

Open
#102 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.2k
Forks
385
PR merge metrics
No merged PRs in 30d

Description

Hi,

In my Python 3.8 environment I'm facing this issue when I try to import KeyBERT.
Here is the full stack trace:

```
ImportError Traceback (most recent call last)
in
18
19 from keyphrase_vectorizers import KeyphraseCountVectorizer, KeyphraseTfidfVectorizer
---> 20 from keybert import KeyBERT
21 from flair.embeddings import TransformerDocumentEmbeddings
22

/opt/conda/lib/python3.8/site-packages/keybert/__init__.py in
----> 1 from keybert._model import KeyBERT
2
3 __version__ = "0.5.0"

/opt/conda/lib/python3.8/site-packages/keybert/_model.py in
11 from keybert._mmr import mmr
12 from keybert._maxsum import max_sum_similarity
---> 13 from keybert._highlight import highlight_document
14 from keybert.backend._utils import select_backend
15

/opt/conda/lib/python3.8/site-packages/keybert/_highlight.py in
1 import re
----> 2 from rich.console import Console
3 from rich.highlighter import RegexHighlighter
4 from typing import Tuple, List
5

/opt/conda/lib/python3.8/site-packages/rich/console.py in
44 from . import errors, themes
45 from ._emoji_replace import _emoji_replace
---> 46 from ._log_render import FormatTimeCallable, LogRender
47 from .align import Align, AlignMethod
48 from .color import ColorSystem

/opt/conda/lib/python3.8/site-packages/rich/_log_render.py in
3
4
----> 5 from .text import Text, TextType
6
7 if TYPE_CHECKING:

/opt/conda/lib/python3.8/site-packages/rich/text.py in
3 from math import gcd
4 from operator import itemgetter
----> 5 from rich.emoji import EmojiVariant
6 from typing import (
7 TYPE_CHECKING,

/opt/conda/lib/python3.8/site-packages/rich/emoji.py in
2 from typing import TYPE_CHECKING, Optional, Union
3
----> 4 from .jupyter import JupyterMixin
5 from .segment import Segment
6 from .style import Style

/opt/conda/lib/python3.8/site-packages/rich/jupyter.py in
2
3 from . import get_console
----> 4 from .segment import Segment
5 from .terminal_theme import DEFAULT_TERMINAL_THEME
6

/opt/conda/lib/python3.8/site-packages/rich/segment.py in
17 )
18
---> 19 from .cells import (
20 _is_single_cell_widths,
21 cell_len,

/opt/conda/lib/python3.8/site-packages/rich/cells.py in
4
5 from ._cell_widths import CELL_WIDTHS
----> 6 from ._lru_cache import LRUCache
7
8 # Regex to match sequence of the most common character ranges

/opt/conda/lib/python3.8/site-packages/rich/_lru_cache.py in
6
7 if sys.version_info < (3, 9):
----> 8 from typing_extensions import OrderedDict
9 else:
10 from collections import OrderedDict

ImportError: cannot import name 'OrderedDict' from 'typing_extensions' (/opt/conda/lib/python3.8/site-packages/typing_extensions.py)
```
I'm facing this issue when using with both version 0.5.0 and 0.5.1. Please suggest if there is a workaround for this issue.

Thanks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Python 3.8 import failure using the traceback's KeyBERT import path and inspect the project's dependency metadata alongside rich and typing_extensions versions. Determine the supported compatible dependency range or required package change, then verify that importing KeyBERT succeeds in Python 3.8.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.