quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.28k stars 1.02k forks source link

pin quimb and numba versions to fix CI #6438

Closed NoureldinYosri closed 9 months ago

NoureldinYosri commented 9 months ago

fixes https://github.com/quantumlib/Cirq/issues/6437

older versions of quimb use a numbda decorator that no longer exists. the recent release of quimb fixes that https://github.com/jcmgray/quimb/blob/0f9db3f7b81e50375b5001296bfc2b767a7e557d/docs/changelog.md however it breaks tests in /contrib/quimb so will pin the versions for now.

pavoljuhas commented 9 months ago

I am getting a reproducible decimal.DivisionByZero exception after the quimb update -

check/pytest -n0 cirq-core/cirq/contrib/quimb/grid_circuits_test.py::test_tensor_expectation_value -x --tb=native
output ======================================================= FAILURES ======================================================= ____________________________________________ test_tensor_expectation_value _____________________________________________ Traceback (most recent call last): File "/tmp/t39/lib/python3.9/site-packages/_pytest/runner.py", line 341, in from_call result: Optional[TResult] = func() File "/tmp/t39/lib/python3.9/site-packages/_pytest/runner.py", line 262, in lambda: ihook(item=item, **kwds), when=when, reraise=reraise File "/tmp/t39/lib/python3.9/site-packages/pluggy/_hooks.py", line 501, in __call__ return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) File "/tmp/t39/lib/python3.9/site-packages/pluggy/_manager.py", line 119, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "/tmp/t39/lib/python3.9/site-packages/pluggy/_callers.py", line 181, in _multicall return outcome.get_result() File "/tmp/t39/lib/python3.9/site-packages/pluggy/_result.py", line 99, in get_result raise exc.with_traceback(exc.__traceback__) File "/tmp/t39/lib/python3.9/site-packages/pluggy/_callers.py", line 102, in _multicall res = hook_impl.function(*args) File "/tmp/t39/lib/python3.9/site-packages/_pytest/runner.py", line 177, in pytest_runtest_call raise e File "/tmp/t39/lib/python3.9/site-packages/_pytest/runner.py", line 169, in pytest_runtest_call item.runtest() File "/tmp/t39/lib/python3.9/site-packages/_pytest/python.py", line 1792, in runtest self.ihook.pytest_pyfunc_call(pyfuncitem=self) File "/tmp/t39/lib/python3.9/site-packages/pluggy/_hooks.py", line 501, in __call__ return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) File "/tmp/t39/lib/python3.9/site-packages/pluggy/_manager.py", line 119, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "/tmp/t39/lib/python3.9/site-packages/pluggy/_callers.py", line 181, in _multicall return outcome.get_result() File "/tmp/t39/lib/python3.9/site-packages/pluggy/_result.py", line 99, in get_result raise exc.with_traceback(exc.__traceback__) File "/tmp/t39/lib/python3.9/site-packages/pluggy/_callers.py", line 102, in _multicall res = hook_impl.function(*args) File "/tmp/t39/lib/python3.9/site-packages/_pytest/python.py", line 194, in pytest_pyfunc_call result = testfunction(**testargs) File "/usr/local/google/home/juhas/Code/gh/quantumlib/Cirq2/cirq-core/cirq/contrib/quimb/grid_circuits_test.py", line 74, in test_tensor_expectation_value eval_tn = ccq.tensor_expectation_value(circuit, operator) File "/usr/local/google/home/juhas/Code/gh/quantumlib/Cirq2/cirq-core/cirq/contrib/quimb/state_vector.py", line 173, in tensor_expectation_value path_info = tn.contract(get='path-info') File "/tmp/t39/lib/python3.9/site-packages/quimb/tensor/tensor_core.py", line 8448, in contract return tensor_contract(*self.tensor_map.values(), **opts) File "/tmp/t39/lib/python3.9/site-packages/quimb/tensor/tensor_core.py", line 262, in tensor_contract return _tensor_contract_get_other( File "/tmp/t39/lib/python3.9/site-packages/quimb/tensor/tensor_core.py", line 167, in _tensor_contract_get_other pathinfo = array_contract_pathinfo( File "/tmp/t39/lib/python3.9/site-packages/quimb/tensor/contraction.py", line 329, in array_contract_pathinfo return oe.contract_path(eq, *shapes, shapes=True, optimize=path)[1] File "/tmp/t39/lib/python3.9/site-packages/opt_einsum/contract.py", line 327, in contract_path path_print = PathInfo(contraction_list, input_subscripts, output_subscript, indices, path, scale_list, naive_cost, File "/tmp/t39/lib/python3.9/site-packages/opt_einsum/contract.py", line 38, in __init__ self.speedup = self.naive_cost / self.opt_cost decimal.DivisionByZero: [] =================================================== warnings summary =================================================== cirq-core/cirq/_compat.py:31 /usr/local/google/home/juhas/Code/gh/quantumlib/Cirq2/cirq-core/cirq/_compat.py:31: DeprecationWarning: Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0), (to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries) but was not found to be installed on your system. If this would cause problems for you, please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466 import pandas as pd ../../../../../../../../../tmp/t39/lib/python3.9/site-packages/cotengra/hyperoptimizers/hyper.py:34 /tmp/t39/lib/python3.9/site-packages/cotengra/hyperoptimizers/hyper.py:34: UserWarning: Couldn't import `kahypar` - skipping from default hyper optimizer and using basic `labels` method instead. warnings.warn( -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =============================================== short test summary info ================================================ FAILED cirq-core/cirq/contrib/quimb/grid_circuits_test.py::test_tensor_expectation_value - decimal.DivisionByZero: [] ============================================ 1 failed, 2 warnings in 2.38s =============================================
NoureldinYosri commented 9 months ago

@pavoljuhas yea same. looks like the latest quimb breaks the tests in contrib/quimb. I changed the approch to pinning both quimb and numba to older versions

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (2ef1909) 97.81% compared to head (e3fedf5) 97.81%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6438 +/- ## ========================================== - Coverage 97.81% 97.81% -0.01% ========================================== Files 1111 1111 Lines 97143 97143 ========================================== - Hits 95022 95017 -5 - Misses 2121 2126 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.