markdown does not import on ArchLinux (original) (raw)
I am forwarding here the bug I have received in retext-project/retext#458:
Traceback (most recent call last): File "", line 1, in import markdown File "/usr/lib/python3.7/site-packages/markdown/init.py", line 67, in 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