
    z	i.5                     J   S r SSKrSSKJrJr  \R                  " \	5      r
\" SSSS9r\" S	S
SS9r\" SSSS9r\" SSSS9r\" SSSS9r\" SSSS9r\" SSS9r\" SSS.SSS9r\" S S!S9r\" S"S#S9r\" S$S%S9r\" S&SS'.S(S)S9r\" / S*QS+S9r\" S,S-S.S9r\" S/S0S9r\" S1S2S3S9r\" S4S5S6S9r\" S7S8S9r\" S9S:S9r\" S;S<S=.S>S?S9r\" S@SAS9r\" SBSCS9r \" SDSE0SFSGS9r!\" SHSISJS9r"\" SKSLS9r#\" SMSNS9r$\" SOSPS9r%\" SQSRS9r&\" SSSTS9r'\" SUSVS9r(\" SWSXSYSZ9r)\" S[S\S]9r*\" S^S_S]9r+g)`aW#  
.. currentmodule:: qiskit.utils.optionals

Qiskit has several features that are enabled only if certain *optional* dependencies
are satisfied. This module, :mod:`qiskit.utils.optionals`, has a collection of objects that can
be used to test if certain functionality is available, and optionally raise
:class:`.MissingOptionalLibraryError` if the functionality is not available.


Available Testers
=================

Qiskit Components
-----------------

.. py:data:: HAS_AER

    `Qiskit Aer <https://qiskit.github.io/qiskit-aer/>` provides high-performance simulators for
    the quantum circuits constructed within Qiskit.

.. py:data:: HAS_IBMQ

    The :mod:`Qiskit IBMQ Provider <qiskit.providers.ibmq>` is used for accessing IBM Quantum
    hardware in the IBM cloud.

.. py:data:: HAS_IGNIS

    :mod:`Qiskit Ignis <qiskit.ignis>` provides tools for quantum hardware verification, noise
    characterization, and error correction.

.. py:data:: HAS_TOQM

    `Qiskit TOQM <https://github.com/qiskit-toqm/qiskit-toqm>`__ provides transpiler passes
    for the `Time-optimal Qubit mapping algorithm <https://doi.org/10.1145/3445814.3446706>`__.


External Python Libraries
-------------------------

.. py:data:: HAS_CONSTRAINT

    `python-constraint <https://github.com/python-constraint/python-constraint>`__ is a
    constraint satisfaction problem solver, used in the :class:`~.CSPLayout` transpiler pass.

.. py:data:: HAS_CPLEX

    The `IBM CPLEX Optimizer <https://www.ibm.com/analytics/cplex-optimizer>`__ is a
    high-performance mathematical programming solver for linear, mixed-integer and quadratic
    programming. This is no longer by Qiskit, but it weas historically and the optional
    remains for backwards compatibility.

.. py:data:: HAS_CVXPY

    `CVXPY <https://www.cvxpy.org/>`__ is a Python package for solving convex optimization
    problems.  It is required for calculating diamond norms with
    :func:`.quantum_info.diamond_norm`.

.. py:data:: HAS_DOCPLEX

    `IBM Decision Optimization CPLEX Modelling
    <http://ibmdecisionoptimization.github.io/docplex-doc/>`__ is a library for prescriptive
    analysis.  Like CPLEX, this is no longer by Qiskit, but it weas historically and the
    optional remains for backwards compatibility.

.. py:data:: HAS_FIXTURES

    The test suite has additional features that are available if the optional `fixtures
    <https://launchpad.net/python-fixtures>`__ module is installed.  This generally also needs
    :data:`HAS_TESTTOOLS` as well.  This is generally only needed for Qiskit developers.

.. py:data:: HAS_IPYTHON

    If `the IPython kernel <https://ipython.org/>`__ is available, certain additional
    visualizations and line magics are made available.

.. py:data:: HAS_IPYWIDGETS

    Monitoring widgets for jobs running on external backends can be provided if `ipywidgets
    <https://ipywidgets.readthedocs.io/en/latest/>`__ is available.

.. py:data:: HAS_JAX

    Some methods of gradient calculation within :mod:`.opflow.gradients` require `JAX
    <https://github.com/google/jax>`__ for autodifferentiation.

.. py:data:: HAS_JUPYTER

    Some of the tests require a complete `Jupyter <https://jupyter.org/>`__ installation to test
    interactivity features.

.. py:data:: HAS_MATPLOTLIB

    Qiskit provides several visualization tools in the :mod:`.visualization` module.
    Almost all of these are built using `Matplotlib <https://matplotlib.org/>`__, which must
    be installed in order to use them.

.. py:data:: HAS_NETWORKX

    No longer used by Qiskit.  Internally, Qiskit now uses the high-performance `rustworkx
    <https://github.com/Qiskit/rustworkx>`__ library as a core dependency, and during the
    change-over period, it was sometimes convenient to convert things into the Python-only
    `NetworkX <https://networkx.org/>`__ format.  Some tests of application modules, such as
    `Qiskit Nature <https://qiskit-community.github.io/qiskit-nature/>`__ still use NetworkX.

.. py:data:: HAS_NLOPT

    `NLopt <https://nlopt.readthedocs.io/en/latest/>`__ is a nonlinear optimization library,
    used by the global optimizers in the :mod:`.algorithms.optimizers` module.

.. py:data:: HAS_PIL

    PIL is a Python image-manipulation library.  Qiskit actually uses the `pillow
    <https://pillow.readthedocs.io/en/stable/>`__ fork of PIL if it is available when generating
    certain visualizations, for example of both :class:`.QuantumCircuit` and
    :class:`.DAGCircuit` in certain modes.

.. py:data:: HAS_PYDOT

    For some graph visualizations, Qiskit uses `pydot <https://github.com/pydot/pydot>`__ as an
    interface to GraphViz (see :data:`HAS_GRAPHVIZ`).

.. py:data:: HAS_PYGMENTS

    Pygments is a code highlighter and formatter used by many environments that involve rich
    display of code blocks, including Sphinx and Jupyter.  Qiskit uses this when producing rich
    output for these environments.

.. py:data:: HAS_PYLATEX

    Various LaTeX-based visualizations, especially the circuit drawers, need access to the
    `pylatexenc <https://github.com/phfaist/pylatexenc>`__ project to work correctly.

.. py:data:: HAS_QASM3_IMPORT

    The functions :func:`.qasm3.load` and :func:`.qasm3.loads` for importing OpenQASM 3 programs
    into :class:`.QuantumCircuit` instances use `an external importer package
    <https://qiskit.github.io/qiskit-qasm3-import>`__.

.. py:data:: HAS_SEABORN

    Qiskit provides several visualization tools in the :mod:`.visualization` module.  Some
    of these are built using `Seaborn <https://seaborn.pydata.org/>`__, which must be installed
    in order to use them.

.. py:data:: HAS_SKLEARN

    Some of the gradient functions in :mod:`.opflow.gradients` use regularisation methods from
    `Scikit Learn <https://scikit-learn.org/stable/>`__.

.. py:data:: HAS_SKQUANT

    Some of the optimisers in :mod:`.algorithms.optimizers` are based on those found in `Scikit
    Quant <https://github.com/scikit-quant/scikit-quant>`__, which must be installed to use
    them.

.. py:data:: HAS_SQSNOBFIT

    `SQSnobFit <https://pypi.org/project/SQSnobFit/>`__ is a library for the "stable noisy
    optimization by branch and fit" algorithm.  It is used by the :class:`.SNOBFIT` optimizer.

.. py:data:: HAS_SYMENGINE

    `Symengine <https://github.com/symengine/symengine>`__ is a fast C++ backend for the
    symbolic-manipulation library `Sympy <https://www.sympy.org/en/index.html>`__.  This
    dependency is used to load legacy QPY formats, where this package was used to handle
    :class:`~.circuit.Parameter`\ s.

.. py:data:: HAS_SYMPY

    `SymPy <https://www.sympy.org/en/index.html>`__ is Python library for symbolic mathematics.
    ``SymPy`` was historically used for the implementation of the :class:`.ParameterExpression`
    class but isn't any longer. However it is needed for some legacy functionality that uses
    :meth:`.ParameterExpression.sympify`. It is also used in some visualization functions
    and template matching.

.. py:data:: HAS_TESTTOOLS

    Qiskit's test suite has more advanced functionality available if the optional
    `testtools <https://pypi.org/project/testtools/>`__ library is installed.  This is generally
    only needed for Qiskit developers.

.. py:data:: HAS_TWEEDLEDUM

    `Tweedledum <https://github.com/boschmitt/tweedledum>`__ is an extension library for
    synthesis and optimization of circuits that may involve classical oracles. In the past
    Qiskit's :class:`.PhaseOracle` used this but it is no longer used by Qiskit.

.. py:data:: HAS_Z3

    `Z3 <https://github.com/Z3Prover/z3>`__ is a theorem prover, used in the
    :class:`.CrosstalkAdaptiveSchedule` and :class:`.HoareOptimizer` transpiler passes.

External Command-Line Tools
---------------------------

.. py:data:: HAS_GRAPHVIZ

    For some graph visualizations, Qiskit uses the `GraphViz <https://graphviz.org/>`__
    visualization tool via its ``pydot`` interface (see :data:`HAS_PYDOT`).

.. py:data:: HAS_PDFLATEX

    Visualization tools that use LaTeX in their output, such as the circuit drawers, require
    ``pdflatex`` to be available.  You will generally need to ensure that you have a working
    LaTeX installation available, and the ``qcircuit.tex`` package.

.. py:data:: HAS_PDFTOCAIRO

    Visualization tools that convert LaTeX-generated files into rasterized images use the
    ``pdftocairo`` tool.  This is part of the `Poppler suite of PDF tools
    <https://poppler.freedesktop.org/>`__.


Lazy Checker Classes
====================

.. currentmodule:: qiskit.utils

Each of the lazy checkers is an instance of :class:`.LazyDependencyManager` in one of its two
subclasses: :class:`.LazyImportTester` and :class:`.LazySubprocessTester`.  These should be imported
from :mod:`.utils` directly if required, such as::

    from qiskit.utils import LazyImportTester

.. autoclass:: qiskit.utils.LazyDependencyManager
    :members:

.. autoclass:: qiskit.utils.LazyImportTester
.. autoclass:: qiskit.utils.LazySubprocessTester
    N   )LazyImportTesterLazySubprocessTester
qiskit_aerz
Qiskit Aerzpip install qiskit-aer)nameinstallzqiskit.providers.ibmqzIBMQ Providerz pip install qiskit-ibmq-providerzqiskit.igniszQiskit Igniszpip install qiskit-ignisqiskit_toqmzQiskit TOQMzpip install qiskit-toqm
constraintzpython-constraintzpip install python-constraintcplexzpip install cplexz9This may not be possible for all Python versions and OSes)r   msgcvxpyzpip install cvxpy)r    )Model)docplexzdocplex.mp.modelzpip install docplexfixtureszpip install fixturesIPythonzpip install ipython
ipywidgetszpip install ipywidgets)gradjit)jaxz	jax.numpyr   zpip install jax)jupyternbformat	nbconvertzpip install jupyter)zmatplotlib.patcheszmatplotlib.pyplot
matplotlibzpip install matplotlibnetworkxzpip install networkxnloptzNLopt Optimizerzpip install nloptz	PIL.Imagepillowzpip install pillowpydotzpip install pydotpygmentszpip install pygments)LatexNodes2Text)utf8tolatex)zpylatexenc.latex2textzpylatexenc.latexencode
pylatexenczpip install pylatexencqiskit_qasm3_importzpip install qiskit_qasm3_importseabornzpip install seabornzsklearn.linear_model)RidgeLassozscikit-learnzpip install scikit-learnzskquant.optzscikit-quantzpip install scikit-quant	SQSnobFitzpip install SQSnobFit	symenginezpip install symengine<0.14sympyzpip install sympy	testtoolszpip install testtools
tweedledumzpip install tweedledumz3zpip install z3-solver)dotz-VGraphvizzTo 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)r   r   )pdflatexz-versionzIYou will likely need to install a full LaTeX distribution for your system)r   )
pdftocairoz-vz2This is part of the 'poppler' set of PDF utilities),__doc__logging_logginglazy_testerr   _LazyImportTesterr   _LazySubprocessTester	getLogger__name___loggerHAS_AERHAS_IBMQ	HAS_IGNISHAS_TOQMHAS_CONSTRAINT	HAS_CPLEX	HAS_CVXPYHAS_DOCPLEXHAS_FIXTURESHAS_IPYTHONHAS_IPYWIDGETSHAS_JAXHAS_JUPYTERHAS_MATPLOTLIBHAS_NETWORKX	HAS_NLOPTHAS_PIL	HAS_PYDOTHAS_PYGMENTSHAS_PYLATEXHAS_QASM3_IMPORTHAS_SEABORNHAS_SKLEARNHAS_SKQUANTHAS_SQSNOBFITHAS_SYMENGINE	HAS_SYMPYHAS_TESTTOOLSHAS_TWEEDLEDUMHAS_Z3HAS_GRAPHVIZHAS_PDFLATEXHAS_PDFTOCAIROr       P/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/utils/optionals.py<module>r]      sg  eT 
 

X
&
	$
 	.
 	&	
 ]Hab"	+ C	
 g/BC	
3!C
 !5KL	3HI"<9QR
"-	
   DNcd"/	$
 !5KLg,=GZ[	
Kh@T
Ug/BC	 5KL!5"2 
$ %#D   	3HI/0	&
  	&
 "+7NO!+7STg/BC	!+7NO"<9QR	4)@	A$		9	 %S '<r[   