0
$\begingroup$

I'm trying to follow tutorial on pulse simulation described in qiskit.org. The generated PulseQobj is well executed with AER simulator, but it throws JSONDecodeError when using real backends (ex. ibmq-armonk). The PulseQobj passed the validation (validate_qobj_against_schema), so I'm struggling to find the reason. Qobj, generated by QuantumCircuit command, does not raise this error.

I connected to real device with APItoken, and qiskit version is up to date (qiskit 0.22.0). Below is the trial code with real device, and log after backend.run(PulseQobj)

%matplotlib inline

import numpy as np
from qiskit.ignis.characterization.calibrations import rabi_schedules, RabiFitter
from qiskit.pulse import DriveChannel
from qiskit.compiler import assemble
from qiskit.qobj.utils import MeasLevel, MeasReturnType
from qiskit import IBMQ

IBMQ.enable_account(APItoken, proxies = ProxyConfig, verify = certPath)
provider = IBMQ.get_provider(hub=hub, group=group, project=project)
backend = provider.get_backend(device)

# qubit list
qubits = [0]

# drive amplitudes to use
num_exps = 64
drive_amps = np.linspace(0, 1.0, num_exps)

# drive shape parameters
drive_duration = 2048
drive_sigma = 256

# list of drive channels
drive_channels = [DriveChannel(0)]

# construct the schedules
rabi_schedules, xdata = rabi_schedules(amp_list=drive_amps, 
                                       qubits=qubits, 
                                       pulse_width=drive_duration, 
                                       pulse_sigma=drive_sigma,
                                       drives=drive_channels, 
                                       inst_map=backend.defaults().instruction_schedule_map, 
                                       meas_map=backend.configuration().meas_map)

rabi_qobj = assemble(rabi_schedules, 
                     backend=backend,
                     meas_level=1, 
                     meas_return='avg',
                     shots=512)

result = backend.run(rabi_qobj).result()

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-17-16f293a93614> in <module>
----> 1 result = backend.run(rabi_qobj).result()

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
$\endgroup$
2
  • $\begingroup$ Consider adding the minimum failing example. Also, no need to include the full traceback, just the first and last section would make it... $\endgroup$
    – luciano
    Commented Oct 16, 2020 at 17:16
  • $\begingroup$ Thanks for the comment. I edited the post. $\endgroup$
    – Jin
    Commented Oct 18, 2020 at 23:10

1 Answer 1

1
$\begingroup$

It's actually a networking error. Long story short, in some cases the server gives back a 200 ok code but an empty response that JSON fails to decode. There is an issue open to mask this. The good news is it usually goes away if you retry.

$\endgroup$
6
  • $\begingroup$ Thanks for the comment. But in my case, this error does not goes away with retry. Actually, I didn't have any problem on networking to real device with Qobj, which is generated with QuantumCircuit command. Just PulseQobj throws JSON decode error. $\endgroup$
    – Jin
    Commented Oct 18, 2020 at 22:47
  • $\begingroup$ @Jin I was able to run the example you posted on ibmq_armonk using Qiskit 0.22.0 successfully. Can you try running it without proxies? Some people had reported issues when running with proxies. Also can you post the output of qiskit.__qiskit_version__? Sometimes mismatching versions can happen for whatever reason. $\endgroup$
    – jyu00
    Commented Oct 19, 2020 at 13:17
  • $\begingroup$ Thanks for the comment. Because I'm behind the institute's firewall, proxy option is required to access IBM account. As you pointed out, in my jupyter environment, qiskit is imported from the wrong path. I resolved this issue, and qiskit.__qiskit_version__ now indicates {'qiskit-terra': '0.16.0', 'qiskit-aer': '0.7.0', 'qiskit-ignis': '0.5.0', 'qiskit-ibmq-provider': '0.11.0', 'qiskit-aqua': '0.8.0', 'qiskit': '0.23.0'}. However, now I got HTTPError: 403 Client Error, IBMQBackendAPIError. So...things are getting complicated. Following error log, it seems API error code 3458. $\endgroup$
    – Jin
    Commented Oct 20, 2020 at 2:50
  • $\begingroup$ Error code 3458 means you've reached the maximum number of concurrent jobs you're allowed. You can use backend.job_limit().maximum_jobs to see what the limit is. And most error codes are documented here: quantum-computing.ibm.com/docs/manage/errors $\endgroup$
    – jyu00
    Commented Oct 20, 2020 at 12:39
  • $\begingroup$ I've seen wrong error code. It's just HTTPError, RequestsAPIError and IBMQBackendApiError. I think it is still networking error. Meanwhile, as you commented, I checked the backend.job_limit().maximum_jobs and backend.job_limit().active_jobs. Even though there are no active jobs, same error occurs when the job is submitted. $\endgroup$
    – Jin
    Commented Oct 20, 2020 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.