CQCL/pytket-extensions

[pytket-qsharp] Timeout error constructing `AzureBackend`

cqc-alec opened this issue · 1 comments

from pytket.extensions.qsharp import AzureBackend
b = AzureBackend("ionq.simulator")

The error comes from qsharp.azure.connect():

---------------------------------------------------------------------------
TimeoutError                              Traceback (most recent call last)
<ipython-input-2-9013a804ef5a> in <module>
----> 1 b = AzureBackend("ionq.simulator")

~/r/pytket-extensions/modules/pytket-qsharp/pytket/extensions/qsharp/backends/azure_quantum.py in __init__(self, target_name, resourceId, location, storage, machine_debug)
    128 
    129             try:
--> 130                 target_list = qsharp.azure.connect(**config.__dict__)
    131             except qsharp.azure.AzureError as e:
    132                 if e.error_name == "AuthenticationFailed":

~/r/pytket-extensions/env-pytket-extensions-3.9/lib/python3.9/site-packages/qsharp/azure.py in connect(**params)
    107     See https://docs.microsoft.com/qsharp/api/iqsharp-magic/azure.connect for more details.
    108     """
--> 109     result = qsharp.client._execute_magic(f"azure.connect", raise_on_stderr=False, **params)
    110     if "error_code" in result: raise AzureError(result)
    111     return [AzureTarget(target) for target in result]

~/r/pytket-extensions/env-pytket-extensions-3.9/lib/python3.9/site-packages/qsharp/clients/iqsharp.py in _execute_magic(self, magic, raise_on_stderr, _quiet_, **kwargs)
    280     def _execute_magic(self, magic : str, raise_on_stderr : bool = False, _quiet_ : bool = False, **kwargs) -> Any:
    281         _timeout_ = kwargs.pop('_timeout_', DEFAULT_TIMEOUT)
--> 282         return self._execute(
    283             f'%{magic} {json.dumps(map_tuples(kwargs))}',
    284             raise_on_stderr=raise_on_stderr, _quiet_=_quiet_, _timeout_=_timeout_

~/r/pytket-extensions/env-pytket-extensions-3.9/lib/python3.9/site-packages/qsharp/clients/iqsharp.py in _execute(self, input, return_full_result, raise_on_stderr, output_hook, display_data_handler, _timeout_, _quiet_, **kwargs)
    370                 raise AlreadyExecutingError("Cannot execute through the IQ# client while another execution is completing.")
    371             self._busy = True
--> 372             reply = self.kernel_client.execute_interactive(input, timeout=_timeout_, output_hook=_output_hook, **kwargs)
    373         finally:
    374             self._busy = False

~/r/pytket-extensions/env-pytket-extensions-3.9/lib/python3.9/site-packages/jupyter_client/blocking/client.py in execute_interactive(self, code, silent, store_history, user_expressions, allow_stdin, stop_on_error, timeout, output_hook, stdin_hook)
    319             events = dict(poller.poll(timeout_ms))
    320             if not events:
--> 321                 raise TimeoutError("Timeout waiting for output")
    322             if stdin_socket in events:
    323                 req = self.stdin_channel.get_msg(timeout=0)

TimeoutError: Timeout waiting for output

PS. Hours later, I noticed that a process was using a lot of CPU; on investigation it turned out to be dotnet-iqsharp. After exiting the python shell in which I'd executed the above command it stopped.