markdown: markdown does not import on ArchLinux

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

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Actually, markdown imports just fine on archlinux… We do not package markdown 3.1 at all, my assumption is because this bug makes it impossible to build any new version of it.

Ping @keenerd