Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip3 on python3.9 fails on 'HTMLParser' object has no attribute 'unescape' [duplicate]

After installing (ubuntu) python3.9, installing some packages with pip failes on:

    Traceback (most recent call last):       File "<string>", line 1, in <module>       File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 14, in <module>         from setuptools.dist import Distribution, Feature       File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 24, in <module>         from setuptools.depends import Require       File "/usr/lib/python3/dist-packages/setuptools/depends.py", line 7, in <module>         from .py33compat import Bytecode       File "/usr/lib/python3/dist-packages/setuptools/py33compat.py", line 54, in <module>         unescape = getattr(html, 'unescape', html_parser.HTMLParser().unescape)     AttributeError: 'HTMLParser' object has no attribute 'unescape'     ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. 
like image 552
borgr Avatar asked Jan 09 '21 07:01

borgr


1 Answers

After some trial and error I upgraded, pip, distlib and setuptools and it solved it. Not sure which of those is causing it. (On the last two I found issues 1 2 of other sites) It is caused by removing unescape from HTMLParser in python3.9, which seems to break setuptools.

pip3 install --upgrade setuptools 

If it does not work, try also:

pip3 install --upgrade pip pip3 install --upgrade distlib 
like image 96
borgr Avatar answered Sep 20 '22 15:09

borgr