poetry shell fails to start due to rapidfuzz missing "MatchingBlock" attribute on ArchLinux with poetry built from git source

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Linux hostname 5.15.53-2-lts SMP Sat, 09 Jul 2022 10:30:57 +0000 x86_64 GNU/Linux
  • Poetry version: 1.2.0b3.r16.gec610a34-1
  • Link of a Gist with the contents of your pyproject.toml file: not relevant

Issue

So poetry was somewhat working, I started having issue when I ran peotry shell about a missing cleo.terminal module, I thus installed python-cleo-git from the AUR, then after that poetry shell told me it’s missing rapidfuzz, I thus installed python-rapidfuzz-git from the AUR again and then hit the following stack trace, I cannot even run poetry --version anymore :

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/rapidfuzz/utils.py", line 17, in _fallback_import
    mod = importlib.import_module(module + "_cpp")
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'rapidfuzz.process_cpp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/rapidfuzz/utils.py", line 17, in _fallback_import
    mod = importlib.import_module(module + "_cpp")
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'rapidfuzz.fuzz_cpp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/poetry", line 5, in <module>
    from poetry.console.application import main
  File "/usr/lib/python3.10/site-packages/poetry/console/application.py", line 12, in <module>
    from cleo.application import Application as BaseApplication
  File "/usr/lib/python3.10/site-packages/cleo/application.py", line 12, in <module>
    from cleo.commands.completions_command import CompletionsCommand
  File "/usr/lib/python3.10/site-packages/cleo/commands/completions_command.py", line 10, in <module>
    from cleo import helpers
  File "/usr/lib/python3.10/site-packages/cleo/helpers.py", line 5, in <module>
    from cleo.io.inputs.argument import Argument
  File "/usr/lib/python3.10/site-packages/cleo/io/inputs/argument.py", line 5, in <module>
    from cleo.exceptions import LogicException
  File "/usr/lib/python3.10/site-packages/cleo/exceptions/__init__.py", line 3, in <module>
    from cleo._utils import find_similar_names
  File "/usr/lib/python3.10/site-packages/cleo/_utils.py", line 8, in <module>
    from rapidfuzz.distance import Levenshtein
  File "/usr/lib/python3.10/site-packages/rapidfuzz/__init__.py", line 8, in <module>
    from rapidfuzz import process, distance, fuzz, string_metric, utils
  File "/usr/lib/python3.10/site-packages/rapidfuzz/process.py", line 7, in <module>
    extract = _fallback_import(_mod, "extract")
  File "/usr/lib/python3.10/site-packages/rapidfuzz/utils.py", line 19, in _fallback_import
    mod = importlib.import_module(module + "_py")
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/lib/python3.10/site-packages/rapidfuzz/process_py.py", line 5, in <module>
    from rapidfuzz.fuzz import WRatio
  File "/usr/lib/python3.10/site-packages/rapidfuzz/fuzz.py", line 7, in <module>
    ratio = _fallback_import(_mod, "ratio")
  File "/usr/lib/python3.10/site-packages/rapidfuzz/utils.py", line 19, in _fallback_import
    mod = importlib.import_module(module + "_py")
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/lib/python3.10/site-packages/rapidfuzz/fuzz_py.py", line 4, in <module>
    from rapidfuzz.distance.Indel_py import (
  File "/usr/lib/python3.10/site-packages/rapidfuzz/distance/__init__.py", line 12, in <module>
    MatchingBlock = _fallback_import(_mod, "MatchingBlock")
  File "/usr/lib/python3.10/site-packages/rapidfuzz/utils.py", line 21, in _fallback_import
    func = getattr(mod, name)
AttributeError: module 'rapidfuzz.distance._initialize_py' has no attribute 'MatchingBlock'

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Secruscommented, Jul 31, 2022

Gentleusers, I am quite sure that this discussion does not belong here. As I mentioned before, only officially supported ways of installing Poetry can be found on our website. Please discuss 3rd party installers in their appropriate repos/pages.

1reaction
pekkarrcommented, Jul 30, 2022

@AkechiShiro Hi, I’m the maintainer of python-rapidfuzz (but not the -git version) on AUR. I added a comment about the issues with the -git package to the AUR page of python-rapidfuzz-git.

However, for using python-cleo-git, installing the normal python-rapidfuzz package is enough. Not having python-rapidfuzz as a dependency is currently a bug in python-cleo-git.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AUR (en) - python-poetry-git - Arch Linux
I'm encountering multiples issues with the latest build from source, namely when issuing a poetry shell I run into the error cleo.terminal ...
Read more >
FS#73867 : [python-poetry] ImportError: attempted relative ...
Description: Poetry fails to install the virtualenv correctly when using the packaged version. When installing using the "install-poetry.py" file that Poetry ...
Read more >
python-poetry 1.3.1-1 (any) - Arch Linux
Repository : Community. Description: Python dependency management and packaging made easy. Upstream URL: https://python-poetry.org.
Read more >
poetry.lock · master - arch-release-promotion - GitLab
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet.".
Read more >
python-poetry-plugin-export 1.2.0-1 (any) - Arch Linux
Architecture: any. Repository: Community. Description: Poetry plugin to export the dependencies to various formats.
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