Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytest Windows flake for supermarq-benchmarks\supermarq\qcvv\xeb_test.py #1103

Open
natibek opened this issue Nov 14, 2024 · 0 comments
Open
Labels
bug Something isn't working flake

Comments

@natibek
Copy link
Contributor

natibek commented Nov 14, 2024

What is happening?

Pytest Windows flakes with error _tkinter.TclError: invalid command name "tcl_findLibrary" for supermarq-benchmarks\supermarq\qcvv\xeb_test.py.

supermarq-benchmarks\supermarq\qcvv\xeb_test.py
============================= test session starts =============================
platform win32 -- Python 3.12.7, pytest-8.3.3, pluggy-1.5.0
Using --randomly-seed=2676077198
rootdir: D:\a\client-superstaq\client-superstaq
configfile: pyproject.toml
plugins: nbmake-1.5.4, cov-6.0.0, randomly-3.16.0, socket-0.7.0, xdist-3.6.1
created: 2/2 workers
2 workers [561 items]

........................................................................ [ 12%]
.....s.................................................................. [ 25%]
..............................................................F......... [ 38%]
........................................................................ [ 51%]
........................................................................ [ 64%]
........................................................................ [ 77%]
........................................................................ [ 89%]
Matplotlib is building the font cache; this may take a moment.
........s................................................                [100%]
================================== FAILURES ===================================
__________________________ test_xeb_analyse_results ___________________________
[gw0] win32 -- Python 3.12.7 C:\hostedtoolcache\windows\Python\3.12.7\x64\python.exe

xeb_experiment = <supermarq.qcvv.xeb.XEB object at 0x00000248E6459EE0>

    def test_xeb_analyse_results(xeb_experiment: XEB) -> None:
        xeb_experiment._samples = MagicMock()
        # Choose example data to give perfect fit with fidelity=0.95
        xeb_experiment._raw_data = pd.DataFrame(
            [
                {
                    "cycle_depth": 1,
                    "circuit_depth": 3,
                    "sum_p(x)p(x)": 0.3,
                    "sum_p(x)p^(x)": 0.95**1 * 0.3,
                },
                {
                    "cycle_depth": 1,
                    "circuit_depth": 3,
                    "sum_p(x)p(x)": 0.5,
                    "sum_p(x)p^(x)": 0.95**1 * 0.5,
                },
                {
                    "cycle_depth": 5,
                    "circuit_depth": [11](https://github.com/Infleqtion/client-superstaq/actions/runs/11825271337/job/32948670957#step:6:12),
                    "sum_p(x)p(x)": 0.3,
                    "sum_p(x)p^(x)": 0.95**5 * 0.3,
                },
                {
                    "cycle_depth": 5,
                    "circuit_depth": 11,
                    "sum_p(x)p(x)": 0.5,
                    "sum_p(x)p^(x)": 0.95**5 * 0.5,
                },
                {
                    "cycle_depth": 10,
                    "circuit_depth": 21,
                    "sum_p(x)p(x)": 0.3,
                    "sum_p(x)p^(x)": 0.95**10 * 0.3,
                },
                {
                    "cycle_depth": 10,
                    "circuit_depth": 21,
                    "sum_p(x)p(x)": 0.5,
                    "sum_p(x)p^(x)": 0.95**10 * 0.5,
                },
            ]
        )
>       results = xeb_experiment.analyze_results()

supermarq-benchmarks\supermarq\qcvv\xeb_test.py:164: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
supermarq-benchmarks\supermarq\qcvv\xeb.py:365: in analyze_results
    self.plot_results()
supermarq-benchmarks\supermarq\qcvv\xeb.py:371: in plot_results
    plot_1 = sns.lmplot(
C:\hostedtoolcache\windows\Python\3.[12](https://github.com/Infleqtion/client-superstaq/actions/runs/11825271337/job/32948670957#step:6:13).7\x64\Lib\site-packages\seaborn\regression.py:614: in lmplot
    facets = FacetGrid(
C:\hostedtoolcache\windows\Python\3.12.7\x64\Lib\site-packages\seaborn\axisgrid.py:453: in __init__
    fig = plt.figure(figsize=figsize)
C:\hostedtoolcache\windows\Python\3.12.7\x64\Lib\site-packages\matplotlib\pyplot.py:1027: in figure
    manager = new_figure_manager(
C:\hostedtoolcache\windows\Python\3.12.7\x64\Lib\site-packages\matplotlib\pyplot.py:550: in new_figure_manager
    return _get_backend_mod().new_figure_manager(*args, **kwargs)
C:\hostedtoolcache\windows\Python\3.12.7\x64\Lib\site-packages\matplotlib\backend_bases.py:3507: in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
C:\hostedtoolcache\windows\Python\3.12.7\x64\Lib\site-packages\matplotlib\backend_bases.py:3512: in new_figure_manager_given_figure
    return cls.FigureCanvas.new_manager(figure, num)
C:\hostedtoolcache\windows\Python\3.12.7\x64\Lib\site-packages\matplotlib\backend_bases.py:[17](https://github.com/Infleqtion/client-superstaq/actions/runs/11825271337/job/32948670957#step:6:18)97: in new_manager
    return cls.manager_class.create_with_canvas(cls, figure, num)
C:\hostedtoolcache\windows\Python\3.12.7\x64\Lib\site-packages\matplotlib\backends\_backend_tk.py:483: in create_with_canvas
    window = tk.Tk(className="matplotlib")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tkinter.Tk object .>, screenName = None, baseName = '-c'
className = 'matplotlib', useTk = True, sync = False, use = None

    def __init__(self, screenName=None, baseName=None, className='Tk',
                 useTk=True, sync=False, use=None):
        """Return a new top level widget on screen SCREENNAME. A new Tcl interpreter will
        be created. BASENAME will be used for the identification of the profile file (see
        readprofile).
        It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME
        is the name of the widget class."""
        self.master = None
        self.children = {}
        self._tkloaded = False
        # to avoid recursions in the getattr code in case of failure, we
        # ensure that self.tk is always _something_.
        self.tk = None
        if baseName is None:
            import os
            baseName = os.path.basename(sys.argv[0])
            baseName, ext = os.path.splitext(baseName)
            if ext not in ('.py', '.pyc'):
                baseName = baseName + ext
        interactive = False
>       self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
E       _tkinter.TclError: invalid command name "tcl_findLibrary"

C:\hostedtoolcache\windows\Python\3.12.7\x64\Lib\tkinter\__init__.py:[23](https://github.com/Infleqtion/client-superstaq/actions/runs/11825271337/job/32948670957#step:6:24)46: TclError
============================== warnings summary ===============================
qiskit-superstaq/qiskit_superstaq/superstaq_backend_test.py::test_retrieve_job
  D:\a\client-superstaq\client-superstaq\qiskit-superstaq\qiskit_superstaq\superstaq_backend_test.py:93: DeprecationWarning: The `.retrieve_job()` method of `SuperstaqBackend` has been deprecated, and will be removed in a future version of qiskit-superstaq. Instead, use the `.get_job()`method of `SuperstaqProvider`.
    assert job == backend.retrieve_job("job_id")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ===========================
FAILED supermarq-benchmarks/supermarq/qcvv/xeb_test.py::test_xeb_analyse_results - _tkinter.TclError: invalid command name "tcl_findLibrary"
============ 1 failed, 558 passed, 2 skipped, 1 warning in [33](https://github.com/Infleqtion/client-superstaq/actions/runs/11825271337/job/32948670957#step:6:34).04s =============
WARNING: no test file found for checks-superstaq/checks_superstaq/__init__.py
WARNING: no test file found for checks-superstaq/checks_superstaq/_version.py
WARNING: no test file found for checks-superstaq/checks_superstaq/all_.py
WARNING: no test file found for checks-superstaq/checks_superstaq/build_docs.py
WARNING: no test file found for checks-superstaq/checks_superstaq/check_utils.py
WARNING: no test file found for checks-superstaq/checks_superstaq/configs.py
WARNING: no test file found for checks-superstaq/checks_superstaq/coverage_.py
WARNING: no test file found for checks-superstaq/checks_superstaq/flake8_.py
WARNING: no test file found for checks-superstaq/checks_superstaq/format_.py
WARNING: no test file found for checks-superstaq/checks_superstaq/mypy_.py
WARNING: no test file found for checks-superstaq/checks_superstaq/pylint_.py
WARNING: no test file found for checks-superstaq/checks_superstaq/pylint_import_annotations.py
WARNING: no test file found for checks-superstaq/checks_superstaq/pylint_init_return.py
WARNING: no test file found for checks-superstaq/checks_superstaq/pytest_.py
WARNING: no test file found for checks-superstaq/checks_superstaq/requirements.py
WARNING: no test file found for checks-superstaq/checks_superstaq/ruff_format_.py
WARNING: no test file found for checks-superstaq/checks_superstaq/ruff_lint_.py
WARNING: no test file found for checks/all_.py
WARNING: no test file found for checks/build_docs.py
WARNING: no test file found for checks/configs.py
WARNING: no test file found for checks/coverage_.py
WARNING: no test file found for checks/flake8_.py
WARNING: no test file found for checks/format_.py
WARNING: no test file found for checks/mypy_.py
WARNING: no test file found for checks/pylint_.py
WARNING: no test file found for checks/pytest_.py
WARNING: no test file found for checks/requirements.py
WARNING: no test file found for checks/ruff_format_.py
WARNING: no test file found for checks/ruff_lint_.py
WARNING: no test file found for cirq-superstaq/cirq_superstaq/__init__.py
WARNING: no test file found for cirq-superstaq/cirq_superstaq/ops/__init__.py
WARNING: no test file found for cirq-superstaq/cirq_superstaq/sampler.py
WARNING: no test file found for dev_tools/locustfile.py
WARNING: no test file found for docs/source/conf.py
WARNING: no test file found for general-superstaq/general_superstaq/__init__.py
WARNING: no test file found for general-superstaq/general_superstaq/_init_vars.py
WARNING: no test file found for general-superstaq/general_superstaq/check/__init__.py
WARNING: no test file found for general-superstaq/general_superstaq/testing.py
WARNING: no test file found for general-superstaq/general_superstaq/typing.py
WARNING: no test file found for qiskit-superstaq/qiskit_superstaq/__init__.py
WARNING: no test file found for qiskit-superstaq/qiskit_superstaq/conftest.py
WARNING: no test file found for supermarq-benchmarks/supermarq/__init__.py
WARNING: no test file found for supermarq-benchmarks/supermarq/benchmarks/__init__.py
WARNING: no test file found for supermarq-benchmarks/supermarq/qcvv/__init__.py
WARNING: no test file found for supermarq-benchmarks/supermarq/qcvv/conftest.py
WARNING: no test file found for supermarq-benchmarks/supermarq/simulation.py
WARNING: no test file found for supermarq-benchmarks/supermarq/stabilizers.py
Error: Process completed with exit code 1.

How can we reproduce the issue?

It fails randomly when testing with Github actions.

What should happen?

PRs where it fails do not include changes to the file. It should not be failing.

Environment

  • Superstaq version: 0.5.39
  • general-superstaq version: 0.5.31
  • cirq-superstaq version: 0.5.31
  • qiskit-superstaq version: 0.5.31
  • Operating system: Ubuntu 22.04.5 LTS
  • Python version:: Python 3.13

Any additional context?

No response

@natibek natibek added bug Something isn't working flake labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flake
Projects
None yet
Development

No branches or pull requests

1 participant