qiskit icon indicating copy to clipboard operation
qiskit copied to clipboard

Improve mesage on failed Graphviz optional

Open jakelishman opened this issue 5 months ago • 3 comments

Summary

I have recently seen several users struggle to install a complete version of Graphviz upon seeing the MissingOptionalLibraryError message. This updates the message to make it clearer that the PyPI distribution graphviz is not the actual Graphviz software, and it must be installed separately.

Details and comments

Fix #11865, also a couple more messages I've seen on the public Qiskit slack.

jakelishman avatar Feb 26 '24 16:02 jakelishman

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

qiskit-bot avatar Feb 26 '24 16:02 qiskit-bot

fwiw, the new failure looks like this:

In [1]: from qiskit.utils import optionals
   ...:
   ...: with optionals.HAS_GRAPHVIZ.disable_locally():
   ...:     optionals.HAS_GRAPHVIZ.require_now("test")
   ...:
---------------------------------------------------------------------------
MissingOptionalLibraryError               Traceback (most recent call last)
Cell In[1], line 4
      1 from qiskit.utils import optionals
      3 with optionals.HAS_GRAPHVIZ.disable_locally():
----> 4     optionals.HAS_GRAPHVIZ.require_now("test")

File ~/code/qiskit/terra/qiskit/utils/lazy_tester.py:221, in LazyDependencyManager.require_now(self, feature)
    219 if self:
    220     return
--> 221 raise MissingOptionalLibraryError(
    222     libname=self._name, name=feature, pip_install=self._install, msg=self._msg
    223 )

MissingOptionalLibraryError: "The 'Graphviz' library is required to use 'test'.  To install, follow the instructions at https://graphviz.org/download/. Qiskit needs the Graphviz binaries, which the 'graphviz' package on pip does not install. You must install the actual Graphviz software."

jakelishman avatar Feb 26 '24 16:02 jakelishman

Pull Request Test Coverage Report for Build 8052272041

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.03%) to 89.332%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 93.81%
crates/qasm2/src/lex.rs 3 91.94%
<!-- Total: 4
Totals Coverage Status
Change from base Build 8052013397: 0.03%
Covered Lines: 59150
Relevant Lines: 66214

💛 - Coveralls

coveralls avatar Feb 26 '24 16:02 coveralls

@Mergifyio backport stable/0.46

1ucian0 avatar Mar 24 '24 20:03 1ucian0

backport stable/0.46

✅ Backports have been created

mergify[bot] avatar Mar 24 '24 20:03 mergify[bot]