Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.28k stars 2.37k forks source link

Test is failing because of missing pillow dependency #13076

Closed tglanz closed 2 months ago

tglanz commented 2 months ago

Environment

What is happening?

After seting up a new fresh environment which is installed from source, the test test_dag_drawer_checks_filename_correct_format in test_dag_drawer.py is failing while running the tests using tox -epy312.

According to the failure message and from what I understand, it is due to pillow missing as a dependency.

Log tail

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "[REDACTED]/qiskit/test/python/visualization/test_dag_drawer.py", line 54, in test_dag_drawer_checks_filename_correct_format
    dag_drawer(self.dag, filename="aaabc")

      File "[REDACTED]/qiskit/qiskit/utils/lazy_tester.py", line 165, in out
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^

      File "[REDACTED]/qiskit/qiskit/utils/lazy_tester.py", line 164, in out
    self.require_now(feature)

      File "[REDACTED]/qiskit/qiskit/utils/lazy_tester.py", line 221, in require_now
    raise MissingOptionalLibraryError(

    qiskit.exceptions.MissingOptionalLibraryError: "The 'pillow' library is required to use 'dag_drawer'. You can install it with 'pip install pillow'."

How can we reproduce the issue?

On a blank environment

git clone git@github.com:Qiskit/qiskit.git

cd qiskit

python -m venv .venv
source .venv/bin/activate

pip install -r ./requirements-dev.txt
pip install -e .

pip install tox
tox -epy312

What should happen?

All tests should pass

Any suggestions?

Add the decorator @unittest.skipUnless(_optionals.HAS_PIL, "PIL not installed") to the test test_dag_drawer_checks_filename_extension