Skip to content

pyperformance html5lib cannot import Mapping (and fails) #82920

Closed

Description

@TravisLazar
BPO 38739
Nosy @vstinner, @tirkarthi

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2019-11-08.08:05:19.031>
created_at = <Date 2019-11-08.01:30:55.756>
labels = ['tests', '3.9', 'type-crash']
title = 'pyperformance html5lib cannot import Mapping (and fails)'
updated_at = <Date 2019-11-12.21:17:32.597>
user = 'https://bugs.python.org/TravisLazar'

bugs.python.org fields:

activity = <Date 2019-11-12.21:17:32.597>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2019-11-08.08:05:19.031>
closer = 'vstinner'
components = ['Tests']
creation = <Date 2019-11-08.01:30:55.756>
creator = 'Travis Lazar'
dependencies = []
files = []
hgrepos = []
issue_num = 38739
keywords = []
message_count = 8.0
messages = ['356219', '356220', '356221', '356227', '356228', '356252', '356402', '356487']
nosy_count = 3.0
nosy_names = ['vstinner', 'xtreak', 'Travis Lazar']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue38739'
versions = ['Python 3.9']

Activity

  1. TravisLazar commented on Nov 8, 2019

    TravisLazarmannequin
    MannequinAuthor

    When running pyperformance html5lib test, the application crashes with "ImportError: cannot import name 'Mapping' from 'collections' (/py3buildpath/lib/python3.9/collections/init.py)"

    To reproduce:

    1 - Build Python from source. I produced with git commit befa032 from cpython GitHub.

    2 - Run pyperformance with: /py3buildpath/bin/pyperformance run --python=/py3buildpath/bin/python3 --venv venvpath -b html5lib -o output.json

    3 - Immediate crash is seen with message:

    #!/bin/sh
      File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/html5lib/_tokenizer.py", line 16, in <module>
        from ._trie import Trie
      File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/html5lib/_trie/__init__.py", line 3, in <module>
        from .py import Trie as PyTrie
      File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/html5lib/_trie/py.py", line 6, in <module>
        from ._base import Trie as ABCTrie
      File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/html5lib/_trie/_base.py", line 3, in <module>
        from collections import Mapping
    ImportError: cannot import name 'Mapping' from 'collections' (/root/py3-tot-no/lib/python3.9/collections/__init__.py)
    ERROR: Benchmark html5lib failed: Benchmark died
    Traceback (most recent call last):
      File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/pyperformance/run.py", line 132, in run_benchmarks
        bench = func(cmd_prefix, options)
      File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/pyperformance/benchmarks/__init__.py", line 244, in BM_html5lib
        return run_perf_script(python, options, "html5lib")
      File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/pyperformance/run.py", line 98, in run_perf_script
        run_command(cmd, hide_stderr=not options.verbose)
      File "/usr/local/src/pyperf-tot-no-venv/lib/python3.9/site-packages/pyperformance/run.py", line 66, in run_command
        raise RuntimeError("Benchmark died")
    RuntimeError: Benchmark died
  2. added
    testsTests in the Lib/test dir
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Nov 8, 2019
  3. TravisLazar commented on Nov 8, 2019

    TravisLazarmannequin
    MannequinAuthor

    Forgot to include that this was built on an aarch64 (Ampere eMAG) system.

  4. tirkarthi commented on Nov 8, 2019

    @tirkarthi
    Member

    collections removed ABC access in 3.9. It seems you are using an older version of pip. Please update to the latest version which has the vendored html5lib package fixed.

  5. tirkarthi commented on Nov 8, 2019

    @tirkarthi
    Member

    Sorry, I misread the traceback itself as if it's from pip. It's from html5lib being incompatible with 3.9 as per the latest release on 1.0.1 (Dec 7, 2017) . There is an issue to request new release with the fix at html5lib/html5lib-python#419 . Maybe you can try building html5lib from their master branch to be used in pyperformance. I would propose closing it as third party.

  6. vstinner commented on Nov 8, 2019

    @vstinner
    Member

    I fixed the issue by disabling temporarily the benchmark, until html5lib is fixed:
    python/pyperformance@8043c15

    --

    That's Python bug tracker. The pyperformance bug tracker is at:
    https://github.com/python/pyperformance/issues

    Your issue is that "import html5lib" fails on Python 3.9 because there is no html5lib release including the fix:
    html5lib/html5lib-python#419

    The bug has already been fixed in html5lib.

    One workaround would be to disable htmllib benchmark on Python 3.9 until html5lib/html5lib-python#419 is fixed.

    --

    collections removed ABC access in 3.9.

    That's bpo-25988 with commit ef092fe.

    --

    pip backported the html5lib patch:
    pypa/pip@ef7ca14#diff-2496ad1eedee846e323ed2916d6c2d24

    The fix is included in pip since pip 19.3.1.

    Note: The ensurepip module of the master branch of Python uses a bundled copy of pip 19.2.3.

  7. TravisLazar commented on Nov 8, 2019

    TravisLazarmannequin
    MannequinAuthor

    Really appreciate all the commentary and references here. Thanks for that.

    The resolution of disabling html5lib in pyperformance is good. I'll assume no html5lib benchmarking in pyperformance (master) until a version of html5lib is released compatible with 3.9.

    Thanks again.

  8. TravisLazar commented on Nov 11, 2019

    TravisLazarmannequin
    MannequinAuthor

    FYI: this affects tornado_http and django_template as well.

  9. vstinner commented on Nov 12, 2019

    @vstinner
    Member

    FYI: this affects tornado_http and django_template as well.

    Please report pyperformance issues at:
    https://github.com/python/pyperformance/issues

  10. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.9 (EOL)end of lifetestsTests in the Lib/test dirtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions