CQCL / pytket-pyquil

pytket-pyquil, extensions for pytket quantum SDK
Apache License 2.0
0 stars 3 forks source link

ImportError caused by tenacity 8.4.0 #85

Closed CalMacCQ closed 2 months ago

CalMacCQ commented 2 months ago

See

https://github.com/jd/tenacity/issues/471

We could wait for v8.4.0 to be yanked/updates or make a hotfix release of pytket-pyquil ourselves.

from pytket.extensions.pyquil import ForestStateBackend
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 from pytket.extensions.pyquil import ForestStateBackend

File ~/work_projects/test-pytket/.venv/lib/python3.11/site-packages/pytket/extensions/pyquil/__init__.py:18
     16 # _metadata.py is copied to the folder after installation.
     17 from ._metadata import __extension_version__, __extension_name__
---> 18 from .backends import ForestBackend, ForestStateBackend
     19 from .pyquil_convert import pyquil_to_tk, tk_to_pyquil, process_characterisation

File ~/work_projects/test-pytket/.venv/lib/python3.11/site-packages/pytket/extensions/pyquil/backends/__init__.py:20
      1 # Copyright 2019-2024 Quantinuum
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     15 """
     16 Backends for connecting to devices and simulators from the Rigetti Forest platform
     17 directly from pytket
     18 """
---> 20 from .forest import ForestBackend, ForestStateBackend

File ~/work_projects/test-pytket/.venv/lib/python3.11/site-packages/pytket/extensions/pyquil/backends/forest.py:21
     18 from logging import warning
     20 import numpy as np
---> 21 from pyquil.api import (
     22     QuantumComputer,
     23     WavefunctionSimulator,
     24     list_quantum_computers,
     25     get_qc,
     26 )
     27 from pyquil.gates import I
     28 from pyquil.paulis import ID, PauliSum, PauliTerm

File ~/work_projects/test-pytket/.venv/lib/python3.11/site-packages/pyquil/__init__.py:3
      1 from pyquil._version import pyquil_version
      2 from pyquil.quil import Program
----> 3 from pyquil.api import list_quantum_computers, get_qc
      5 __version__ = pyquil_version

File ~/work_projects/test-pytket/.venv/lib/python3.11/site-packages/pyquil/api/__init__.py:47
     45 from pyquil.api._engagement_manager import EngagementManager
     46 from pyquil.api._qam import QAM, QAMExecutionResult
---> 47 from pyquil.api._qpu import QPU
     48 from pyquil.api._quantum_computer import (
     49     QuantumComputer,
     50     list_quantum_computers,
     51     get_qc,
     52     local_forest_runtime,
     53 )
     54 from pyquil.api._qvm import QVM

File ~/work_projects/test-pytket/.venv/lib/python3.11/site-packages/pyquil/api/_qpu.py:29
     27 from pyquil._memory import Memory
     28 from pyquil.api._qam import QAM, QAMExecutionResult
---> 29 from pyquil.api._qpu_client import GetBuffersRequest, QPUClient, BufferResponse, RunProgramRequest
     30 from pyquil.quilatom import (
     31     MemoryReference,
     32     BinaryExp,
   (...)
     35     ExpressionDesignator,
     36 )
     39 def decode_buffer(buffer: BufferResponse) -> np.ndarray:

File ~/work_projects/test-pytket/.venv/lib/python3.11/site-packages/pyquil/api/_qpu_client.py:25
     23 from dateutil.tz import tzutc
     24 from qcs_api_client.models import EngagementWithCredentials, EngagementCredentials
---> 25 from tenacity import retry, retry_if_exception_type, stop_after_attempt
     27 from pyquil.api import EngagementManager
     28 from pyquil._version import DOCS_URL

File ~/work_projects/test-pytket/.venv/lib/python3.11/site-packages/tenacity/__init__.py:653
    648             return r.wraps(f)
    650         return wrap
--> 653 from tenacity.asyncio import AsyncRetrying  # noqa:E402,I100
    655 if tornado:
    656     from tenacity.tornadoweb import TornadoRetrying

ModuleNotFoundError: No module named 'tenacity.asyncio'
CalMacCQ commented 2 months ago

Tenacity have now released 8.4.1 which will be pulled from pypi when pytket-pyquil is installed.

https://pypi.org/project/tenacity/8.4.1/