Skip to content

markdown does not import on ArchLinux #825

Closed
@mitya57

Description

@mitya57

I am forwarding here the bug I have received in retext-project/retext#458:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    import markdown
  File "/usr/lib/python3.7/site-packages/markdown/__init__.py", line 67, in <module>
    __version__ = _get_version()
  File "/usr/lib/python3.7/site-packages/markdown/__init__.py", line 64, in _get_version
    return str(packaging.version.Version(v))
AttributeError: module 'pkg_resources._vendor.packaging' has no attribute 'version'

I looked at ArchLinux PKGBUILD file and found out that they are patching setuptools to use system versions of modules such as packaging, instead of vendored versions:

https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/python-setuptools#n26

Now I realized that pkg_resources.extern.packaging is a non-documented module, and we cannot be sure that it exists on all platforms or that it will not be removed in the future. So probably we should switch to the official version of packaging or at least do something like this:

try:
    import packaging
except ImportError:
    from pkg_resources.extern import packaging

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions