python-coveralls icon indicating copy to clipboard operation
python-coveralls copied to clipboard

ImportError for coverage.report.Reporter on AppVeyor

Open dvorapa opened this issue 4 years ago • 4 comments

coveralls
Traceback (most recent call last):
  File "c:\python27\Lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\Lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\projects\pywikibot\env\Scripts\coveralls.exe\__main__.py", line 7, in <module>
  File "c:\projects\pywikibot\env\lib\site-packages\coveralls\__init__.py", line 78, in wear
    from coveralls.control import coveralls
  File "c:\projects\pywikibot\env\lib\site-packages\coveralls\control.py", line 2, in <module>
    from coveralls.report import CoverallsReporter
  File "c:\projects\pywikibot\env\lib\site-packages\coveralls\report.py", line 6, in <module>
    from coverage.report import Reporter
ImportError: cannot import name Reporter

dvorapa avatar Mar 24 '20 19:03 dvorapa

Having the same issue with Github Action. Did you find a solution?

Edit: found solution in #74. You have to install coveralls package instead of python-coveralls.

Deuchnord avatar Jun 06 '20 13:06 Deuchnord

Yes, I found the same solution.

dvorapa avatar Jun 06 '20 14:06 dvorapa

Same problem on Travis.

blag avatar Jul 22 '20 05:07 blag

These exceptions are not specific to AppVeyor and still occur today. Executing within GitHubActions workflow with Py 3.8, 3.9, 3.10, 3.11 and installation from conda-forge:

  • Without installation of either coveralls or python-coveralls, get missing package, as expected.
  • With only coveralls 1.8.0 installed (from conda-forge), get the identical Exception in the title of this issue.
  • With only python-coveralls 2.9.3 installed (from conda-forge), get the identical Exception in the title of this issue.

Here's an Exception trace from one of the workflows.

List of packages in environment: "/home/runner/micromamba-root/envs/anaconda-test-env-py-3.8"

  Name              Version  Build  Channel    
─────────────────────────────────────────────────
  python-coveralls  2.9.3    py_0   conda-forge
/home/runner/micromamba-root/envs/anaconda-test-env-py-3.8/bin/coveralls
Traceback (most recent call last):
  File "/home/runner/micromamba-root/envs/anaconda-test-env-py-3.8/bin/coveralls", line 10, in <module>
    sys.exit(wear())
  File "/home/runner/micromamba-root/envs/anaconda-test-env-py-3.8/lib/python3.8/site-packages/coveralls/__init__.py", line [78](https://github.com/prjemian/spec2nexus/actions/runs/3759487949/jobs/6389108203#step:6:79), in wear
    from coveralls.control import coveralls
  File "/home/runner/micromamba-root/envs/anaconda-test-env-py-3.8/lib/python3.8/site-packages/coveralls/control.py", line 2, in <module>
    from coveralls.report import CoverallsReporter
  File "/home/runner/micromamba-root/envs/anaconda-test-env-py-3.8/lib/python3.8/site-packages/coveralls/report.py", line 6, in <module>
    from coverage.report import Reporter
ImportError: cannot import name 'Reporter' from 'coverage.report' (/home/runner/micromamba-root/envs/anaconda-test-env-py-3.8/lib/python3.8/site-packages/coverage/report.py)
Error: Process completed with exit code 1.

The coverage package reports that coverage.report.Reporter has been deprecated in release 5.0. Current release (just a few days ago) is 7.0.

It is coveralls/report.py, line 6 that calls from coverage.report import Reporter. That's the problem.

To avoid this problem now, should we pin coverage<5 when using coveralls? This still fails with a conda/micromamba install. Switching to pip install for these two packages. And this worked.

Summary: Do not install coverage and coveralls with conda, use pip. And do not install python-coveralls at the same time.

prjemian avatar Dec 22 '22 17:12 prjemian