python-3.xpiphtml5lib

Error using pip - module 'pip._vendor.html5lib' has no attribute 'parse'


This error popped up today while trying to install some packages using pip. Python version - 3.5.4

pip install pytesseract

It gives the following exception :

Collecting pytesseractException:
Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in ru
n
    wb.build(autobuilding=True)
  File "C:\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "C:\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare
_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\Anaconda3\lib\site-packages\pip\req\req_set.py", line 554, in _prepar
e_file
    require_hashes
  File "C:\Anaconda3\lib\site-packages\pip\req\req_install.py", line 278, in pop
ulate_link
    self.link = finder.find_requirement(self, upgrade)
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 465, in find_requirem
ent
    all_candidates = self.find_all_candidates(req.name)
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 423, in find_all_cand
idates
    for page in self._get_pages(url_locations, project_name):
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 811, in get_page
    inst = cls(resp.content, resp.url, resp.headers)
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 728, in __init__
    self.parsed = html5lib.parse(
AttributeError: module 'pip._vendor.html5lib' has no attribute 'parse'

This exception comes up even for pip update commands. html5lib version is 0.999. The following code seems to be working fine.

import html5lib
document = html5lib.parse("<p>Hello World!")

Any pointers as to why this error is coming up would be helpful. Thanks in advance.


Solution

  • I was using anaconda and recently updated conda and anaconda and I recieved this error.

    'conda update pip' fixed it