Troubleshooting#
Solutions and diagnostic guidance for common issues encountered when working with QRMI.
Job Execution Errors#
error: spank_qrmi_c, failed to acquire resource: ibm_brisbane#
Cause: This error occurs when accessing IBM Quantum backends using an Open Plan account on IBM Quantum Platform.
Check:
Setup virtual environment:
python3.11 -m venv ~/{your_pyenv}
source ~/{your_pyenv}/bin/activate
pip install qiskit-ibm-runtime
Create
test.py:
Replace SERVICE_CRN and API_KEY values with your credentials and with your
backend name.
test.py#
1"""A testcase to check if Qiskit Session can be created with the given credentials"""
2from qiskit_ibm_runtime import QiskitRuntimeService, Session
3
4SERVICE_CRN="YOUR_SERVICE_CRN"
5API_KEY="YOUR_APIKEY" # pragma: allowlist secret
6
7service = QiskitRuntimeService(
8 channel="ibm_cloud",
9 instance=SERVICE_CRN,
10 token=API_KEY,
11)
12
13backend = service.backend("<your backend name>")
14with Session(backend=backend, max_time=1) as session:
15 print("Succeeded in obtaining a Qiskit Session")
Run the test case:
python test.py
This will fail due to the error:
You are not authorized to run a session when using the open plan.
Solution:
Use a Premium Plan account, or
Use Batch execution mode`_
Add
QRMI_IBM_QRS_SESSION_MODEenvironment variable with “batch” in yourqrmi_config.json
{
"name": "ibm_brisbane",
"type": "ibm-quantum-compute-service",
"environment": {
"...": "...",
"QRMI_IBM_QRS_SESSION_MODE": "batch"
}
}