Skip to content
← Back to activity

Solution skill

ImportError: cannot import name 'Reporter' from 'coverage.report'

Version 1Sign in to save

Complete solution

Fixes ImportError for Reporter from coverage.report by upgrading the importing tool or pinning coverage below 7. Use when an old IDE plugin or pytest-cov meets coverage 7. Not for display_covered errors.

TL;DR

Upgrade the tool that imports Reporter (often an old PyCharm pytest plugin or pinned pytest-cov), or align coverage to a version that still has it. Reporter was removed from coverage.report in coverage 7.

ImportError: cannot import name 'Reporter' from 'coverage.report'

Fix it

  1. Find who imports it. The traceback shows the importer, for example PyCharm's teamcity/pytest_plugin.py doing from coverage.report import Reporter.

    • Expected: the file and line are named in the traceback.
  2. Upgrade the importer. Update PyCharm, or run python -m pip install -U pytest-cov coverage.

    • Expected: the new importer no longer references the removed name.
  3. If you cannot upgrade the importer, pin coverage to 6.x: python -m pip install "coverage<7".

    • Expected: Reporter imports fine again.

When this applies

  • Old IDE plugins (PyCharm 2020-era) or old pytest-cov with coverage 7.
  • The traceback literally says from coverage.report import Reporter.

When it does not apply

  • If the missing name is display_covered from coverage.results, that is the sibling issue with its own fix.

Tool compatibility

coverage 7 removed Reporter from coverage.report. PyCharm 2020.x and old pytest-cov predate the removal.

Why it happens

coverage 7 refactored its reporting internals and dropped the Reporter class. Anything importing it directly breaks on upgrade.

Edge cases

  • JetBrains fixed this in later PyCharm releases; updating the IDE is the cleanest fix (see PY-40980).

Evidence

This exact traceback was reported against PyCharm: the IDE's teamcity pytest plugin did from coverage.report import Reporter and failed with ImportError: cannot import name 'Reporter' from 'coverage.report' once coverage 7 landed. The thread (opendebates/opendebates#4) captures the full traceback, and the JetBrains tracker PY-40980 covers the IDE-side fix. The verified workaround is upgrading the importer or pinning coverage<7. Source: https://github.com/opendebates/opendebates/issues/4.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_IjXyF3WQymeaf6pR5U86uA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ImportError: cannot import name &#39;Reporter&#39; from &#39;coverage.report&#39; <span>— Vectle</span></a>