Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Ubuntu 24.04, Error: AttributeError: module 'pathlib' has no attribute '_posix_flavour' #4123

Closed
east4ming opened this issue Apr 28, 2024 · 1 comment
Assignees
Labels

Comments

@east4ming
Copy link

east4ming commented Apr 28, 2024

Summary
  1. sudo apt install -y ansible-lint on ubuntu 24.04
  2. ansible-lint, errors:
$ ansible-lint
Traceback (most recent call last):
  File "/usr/bin/ansible-lint", line 5, in <module>
    from ansiblelint.__main__ import _run_cli_entrypoint
  File "/usr/lib/python3/dist-packages/ansiblelint/__main__.py", line 39, in <module>
    from ansiblelint import cli
  File "/usr/lib/python3/dist-packages/ansiblelint/cli.py", line 20, in <module>
    from ansiblelint.file_utils import (
  File "/usr/lib/python3/dist-packages/ansiblelint/file_utils.py", line 15, in <module>
    import wcmatch.pathlib
  File "/usr/lib/python3/dist-packages/wcmatch/pathlib.py", line 218, in <module>
    class PurePosixPath(PurePath):
  File "/usr/lib/python3/dist-packages/wcmatch/pathlib.py", line 221, in PurePosixPath
    _flavour = pathlib._posix_flavour  # type: ignore[attr-defined]
               ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pathlib' has no attribute '_posix_flavour'
Issue Type
  • Bug Report
OS / ENVIRONMENT
$ ansible-lint --version
Traceback (most recent call last):
  File "/usr/bin/ansible-lint", line 33, in <module>
    sys.exit(load_entry_point('ansible-lint==24.2.2', 'console_scripts', 'ansible-lint')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/ansible-lint", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/ansiblelint/__main__.py", line 50, in <module>
    from ansiblelint import cli
  File "/usr/lib/python3/dist-packages/ansiblelint/cli.py", line 21, in <module>
    from ansiblelint.file_utils import (
  File "/usr/lib/python3/dist-packages/ansiblelint/file_utils.py", line 16, in <module>
    import wcmatch.pathlib
  File "/usr/lib/python3/dist-packages/wcmatch/pathlib.py", line 218, in <module>
    class PurePosixPath(PurePath):
  File "/usr/lib/python3/dist-packages/wcmatch/pathlib.py", line 221, in PurePosixPath
    _flavour = pathlib._posix_flavour  # type: ignore[attr-defined]
               ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pathlib' has no attribute '_posix_flavour'
  • ansible installation method: OS package(ubuntu 24.04 source)
  • ansible-lint installation method: OS package(ubuntu 24.04 source)
STEPS TO REPRODUCE
ansible-lint
Desired Behavior

Can use

Actual Behavior

just ansible-lint, then error.

Tasks

Preview Give feedback
No tasks being tracked yet.

Tasks

Preview Give feedback
No tasks being tracked yet.
@ssbarnea
Copy link
Member

@east4ming That seems to be raised on the wrong place. This seems to be a Ubuntu packaging/distribution issue as you installed the apt package, which is not supported by us.

This was already reported to the right place as https://bugs.launchpad.net/ubuntu/+source/ansible-lint/+bug/2060649

I will close it for now now, unless there is a PR that address the issue.

@ssbarnea ssbarnea closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
@ssbarnea ssbarnea removed the new Triage required label Apr 30, 2024
@ssbarnea ssbarnea self-assigned this Apr 30, 2024
@ssbarnea ssbarnea reopened this Apr 30, 2024
@ssbarnea ssbarnea closed this as completed May 1, 2024
@github-project-automation github-project-automation bot moved this from Review to Done in 🧰 devtools project board May 1, 2024
@ansible ansible locked and limited conversation to collaborators May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants