z4r / python-coveralls

Python API for http://coveralls.io
Other
224 stars 80 forks source link

ImportError for coverage.report.Reporter on AppVeyor #77

Open dvorapa opened 4 years ago

dvorapa commented 4 years ago
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
Deuchnord commented 4 years ago

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.

dvorapa commented 4 years ago

Yes, I found the same solution.

blag commented 4 years ago

Same problem on Travis.

prjemian commented 1 year ago

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:

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.