Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running with Python 3.10: cannot import name 'Mapping' from 'collections' #39

Closed
lancelote opened this issue Jul 4, 2021 · 1 comment

Comments

@lancelote
Copy link
Contributor

Running pur -r requirements.txt with Python 3.10 environment raises

Traceback (most recent call last):
  File "/Users/.../.virtualenvs/test_pur_python310/bin/pur", line 5, in <module>
    from pur.__init__ import pur
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/__init__.py", line 37, in <module>
    from pip._internal.index import PackageFinder
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_internal/cli/main_parser.py", line 12, in <module>
    from pip._internal.commands import (
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_internal/commands/__init__.py", line 6, in <module>
    from pip._internal.commands.completion import CompletionCommand
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_internal/commands/completion.py", line 6, in <module>
    from pip._internal.cli.base_command import Command
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_internal/cli/base_command.py", line 24, in <module>
    from pip._internal.index import PackageFinder
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_internal/index.py", line 14, in <module>
    from pip._vendor import html5lib, requests, six
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_vendor/html5lib/__init__.py", line 25, in <module>
    from .html5parser import HTMLParser, parse, parseFragment
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_vendor/html5lib/html5parser.py", line 8, in <module>
    from . import _tokenizer
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_vendor/html5lib/_tokenizer.py", line 16, in <module>
    from ._trie import Trie
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_vendor/html5lib/_trie/__init__.py", line 3, in <module>
    from .py import Trie as PyTrie
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_vendor/html5lib/_trie/py.py", line 6, in <module>
    from ._base import Trie as ABCTrie
  File "/Users/.../.virtualenvs/test_pur_python310/lib/python3.10/site-packages/pur/packages/pip/_vendor/html5lib/_trie/_base.py", line 3, in <module>
    from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)

The bundled version of html5lib is too old to be used with Python 3.10. The latest version doesn't have this problem. Should the vendored pip be upgraded? One can also directly patch vendored html5lib as a cheap fix.

@alanhamlett
Copy link
Owner

Patched with ea9e528 and released in v5.4.2. We should definitely upgrade the vendored pip, but not sure when I'll be able to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants