quantumlib / Cirq

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

CI fails due to incompatible update of `mpmath` #6475

Closed kenya-sk closed 7 months ago

kenya-sk commented 7 months ago

Description of the issue CI pipeline fails due to an incompatible update in the mpmath library used by the Sympy library. The cirq_pre_release installs the pre-release version of mpmath=="1.4.0a0".
mpmath.rational is deorecated due to the update from v1.3.

How to reproduce the issue


docker build --target cirq_pre_release -t cirq_image_pre .
docker run cirq_image_pre python -c "import cirq; assert cirq.__version__ is not None"
``` Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.9/site-packages/cirq/__init__.py", line 19, in from cirq._compat import __cirq_debug__, with_debug File "/usr/local/lib/python3.9/site-packages/cirq/_compat.py", line 32, in import sympy File "/usr/local/lib/python3.9/site-packages/sympy/__init__.py", line 30, in from sympy.core.cache import lazy_function File "/usr/local/lib/python3.9/site-packages/sympy/core/__init__.py", line 9, in from .expr import Expr, AtomicExpr, UnevaluatedExpr File "/usr/local/lib/python3.9/site-packages/sympy/core/expr.py", line 4159, in from .mul import Mul File "/usr/local/lib/python3.9/site-packages/sympy/core/mul.py", line 2193, in from .numbers import Rational File "/usr/local/lib/python3.9/site-packages/sympy/core/numbers.py", line 4567, in _sympy_converter[type(mpmath.rational.mpq(1, 2))] = sympify_mpmath_mpq AttributeError: module 'mpmath' has no attribute 'rational' ``` Information on the `mpmath` library installed with the cirq_pre_release image is as flollows. ``` Name: mpmath Version: 1.4.0a0 Summary: Python library for arbitrary-precision floating-point arithmetic Home-page: Author: Author-email: Fredrik Johansson License: BSD Location: /usr/local/lib/python3.9/site-packages Requires: Required-by: sympy ```

Cirq version

1.3.0
kenya-sk commented 7 months ago

Version 1.4.0 of mpmath is pre-release, so I will fix it to mpmath~=1.3.0 once in the manual.

kenya-sk commented 7 months ago

The error location is Dockerfile in line 26. This one downloads the package from PyPI, but my permission do not allow me to update the package. Therefore, I have changed the version of mpmath in my local environment, and I am hoping that the test will pass.

Can I use test account to download the package from PyPI and make sure it works fine?

NoureldinYosri commented 7 months ago

@pavoljuhas as per offline discussions. I temporarily supressed the failing test to unblock development.