ModuleNotFoundError on GitHub tox test run

Question:

running tests on GitHub and getting the error message below. Weirdly, this error did not occur with the same setup before.

Run python -m tox -- --junit-xml pytest.xml
py38: install_deps> python -I -m pip install pytest pytest-benchmark pytest-xdist
tox: py38
  py38: commands[0]> pytest tests/ --ignore=tests/lab_extension --junit-xml pytest.xml
  ImportError while loading conftest '/home/runner/work/quibbler/quibbler/tests/conftest.py'.
  tests/conftest.py:6: in <module>
      from matplotlib import pyplot as plt
  E   ModuleNotFoundError: No module named 'matplotlib'
  py38: exit 4 (0.87 seconds) /home/runner/work/quibbler/quibbler> pytest tests/ --ignore=tests/lab_extension --junit-xml pytest.xml pid=1849
  py38: FAIL code 4 (4.01=setup[3.14]+cmd[0.87] seconds)
  evaluation failed :( (4.10 seconds)
Error: Process completed with exit code 4.

Link to the failed test:

https://github.com/Technion-Kishony-lab/quibbler/actions/runs/3792710874/jobs/6449140682#step:5:19

Did something change recently in tox?
What to do?

Asked By: royk

||

Answers:

tox version 4 has been released a couple of weeks ago.

There were a couple of breaking changes, see https://tox.wiki/en/latest/faq.html#breaking-changes-in-tox-4

I would recommend to create an issue at https://github.com/tox-dev/tox/issues

In the meantime, to get your CI unblocked, I would recommend to pin tox < 4 in your github actions.

Answered By: Jürgen Gmach
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.