qiskit-community / qiskit-aqua

Quantum Algorithms & Applications (**DEPRECATED** since April 2021 - see readme for more info)
https://qiskit.org/aqua
Apache License 2.0
573 stars 376 forks source link

QSVM tutorial receives connection error: Error code 400 #575

Closed TMaher13 closed 5 years ago

TMaher13 commented 5 years ago

Informations

What is the current behavior?

When I run a variation of the QSVM tutorial found here, it will initially connect to a backend (typically ibmqx2 or ibmqx4), but then fails to fully connect. I was able to run this code a week or so ago without any issues, but now I'm receiving these error messages in a repeated loop. Occasionally, if I wait long enough, after 5-10 minutes the job will be able to connect and give me a result, but not always.

Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}"

Steps to reproduce the problem

This is my code (the breast cancer function can be found here):

feature_dim = 2
n = 2 # How many features to use (dimensionality)
training_dataset_size = 20
testing_dataset_size = 10
sample_Total, training_input, test_input, class_labels = Breast_cancer(training_dataset_size, 
                                                                                       testing_dataset_size, n)
datapoints, class_to_label = split_dataset_to_data_and_labels(test_input)
try:
    # select least busy available device and execute.
    least_busy_device = least_busy(IBMQ.backends(simulator=False))
except:
    print("All devices are currently unavailable.")
    sys.exit()
seed = 10598
feature_map = SecondOrderExpansion(feature_dimension=feature_dim, depth=2, 
                        entanglement='linear')
qsvm = QSVM(feature_map, training_input, test_input)
backend = BasicAer.get_backend('qasm_simulator')
quantum_instance = QuantumInstance(least_busy_device, shots=1, seed=seed,
                                  seed_transpiler=seed, circuit_caching=False, skip_qobj_validation=True)
result = qsvm.run(quantum_instance, timeout=500)
print(result)

Suggested solutions

I am not sure why I am having trouble fully connecting with the backend; I have been able to submit simpler jobs (like a short Bell State) without any issues, but the QSVM has not been able to run without the Error 400 messages.

chunfuchen commented 5 years ago

@TMaher13 do you try to run on ibmq_16_melbourne ?

chunfuchen commented 5 years ago

I ran the same codes on ibmqx2 now and it works but I do get many status 400, too.

2019-06-25 22:29:50,886:qiskit.aqua.algorithms.many_sample.qsvm.qsvm:DEBUG: Building circuits:
|██████████████████████████████████████████████████| 780/780 [00:00:00:00]
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:30:48,106:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:30:59,062:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:31:04,650:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:31:10,964:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:31:19,768:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:31:25,434:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:31:30,909:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:31:41,046:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:31:46,373:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:31:52,017:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:32:00,612:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:32:06,544:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:32:11,633:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:32:19,042:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:32:23,725:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:32:28,560:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Terra job error: "{'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}" 
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
Got a 400 code response to /api/Jobs: {"error":{"status":400,"message":"Generic error","code":"GENERIC_ERROR"}}
2019-06-25 22:32:35,672:qiskit.aqua.utils.run_circuits:INFO: Backend status: BackendStatus(backend_name='ibmqx2', backend_version='1.0.0', operational=True, pending_jobs=4, status_msg='active')
2019-06-25 22:32:35,673:qiskit.aqua.utils.run_circuits:INFO: There are 11 jobs are submitted.
2019-06-25 22:32:35,674:qiskit.aqua.utils.run_circuits:INFO: All job ids:
['5d12d8d07302860078d94b95', '5d12d8d3f5a2c9007258dc79', '5d12d8d66d110f007453daed', '5d12d8d86d110f007453daef', '5d12d8dc628a51007ba1c6ea', '5d12d8e892584d0070da3831', '5d12d8fc782b67007461857b', '5d12d911361a280070fa0b69', '5d12d925782b67007461857d', '5d12d9389ba7e6007350ab65', '5d12d94d628a51007ba1c6ec']
2019-06-25 22:32:35,675:qiskit.aqua.utils.run_circuits:INFO: Running 0-th qobj, job id: 5d12d8d07302860078d94b95
2019-06-25 22:32:36,593:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 0-th qobj, job id: 5d12d8d07302860078d94b95
2019-06-25 22:32:36,594:qiskit.aqua.utils.run_circuits:INFO: Running 1-th qobj, job id: 5d12d8d3f5a2c9007258dc79
2019-06-25 22:32:37,525:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 1-th qobj, job id: 5d12d8d3f5a2c9007258dc79
2019-06-25 22:32:37,526:qiskit.aqua.utils.run_circuits:INFO: Running 2-th qobj, job id: 5d12d8d66d110f007453daed
2019-06-25 22:34:12,980:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 2-th qobj, job id: 5d12d8d66d110f007453daed
2019-06-25 22:34:12,980:qiskit.aqua.utils.run_circuits:INFO: Running 3-th qobj, job id: 5d12d8d86d110f007453daef
2019-06-25 22:34:14,386:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 3-th qobj, job id: 5d12d8d86d110f007453daef
2019-06-25 22:34:14,387:qiskit.aqua.utils.run_circuits:INFO: Running 4-th qobj, job id: 5d12d8dc628a51007ba1c6ea
2019-06-25 22:34:15,320:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 4-th qobj, job id: 5d12d8dc628a51007ba1c6ea
2019-06-25 22:34:15,321:qiskit.aqua.utils.run_circuits:INFO: Running 5-th qobj, job id: 5d12d8e892584d0070da3831
2019-06-25 22:34:17,084:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 5-th qobj, job id: 5d12d8e892584d0070da3831
2019-06-25 22:34:17,084:qiskit.aqua.utils.run_circuits:INFO: Running 6-th qobj, job id: 5d12d8fc782b67007461857b
2019-06-25 22:34:18,027:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 6-th qobj, job id: 5d12d8fc782b67007461857b
2019-06-25 22:34:18,027:qiskit.aqua.utils.run_circuits:INFO: Running 7-th qobj, job id: 5d12d911361a280070fa0b69
2019-06-25 22:34:19,155:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 7-th qobj, job id: 5d12d911361a280070fa0b69
2019-06-25 22:34:19,156:qiskit.aqua.utils.run_circuits:INFO: Running 8-th qobj, job id: 5d12d925782b67007461857d
2019-06-25 22:34:20,070:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 8-th qobj, job id: 5d12d925782b67007461857d
2019-06-25 22:34:20,071:qiskit.aqua.utils.run_circuits:INFO: Running 9-th qobj, job id: 5d12d9389ba7e6007350ab65
2019-06-25 22:34:21,213:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 9-th qobj, job id: 5d12d9389ba7e6007350ab65
2019-06-25 22:34:21,214:qiskit.aqua.utils.run_circuits:INFO: Running 10-th qobj, job id: 5d12d94d628a51007ba1c6ec
2019-06-25 22:34:22,230:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 10-th qobj, job id: 5d12d94d628a51007ba1c6ec
2019-06-25 22:34:22,271:qiskit.aqua.algorithms.many_sample.qsvm.qsvm:DEBUG: Calculating overlap:
|██████████████████████████████████████████████████| 780/780 [00:00:00:00]
2019-06-25 22:34:52,017:qiskit.aqua.utils.qp_solver:DEBUG: Solving QP problem is completed.
TMaher13 commented 5 years ago

@chunfuchen I receive the same status 400 codes when running on ibmq_16_melbourne.

chunfuchen commented 5 years ago

@TMaher13 do you mind refer to my comment here https://github.com/Qiskit/qiskit-aqua/issues/584#issuecomment-506503091? Please let me know if you still encounter this issue when you switch to new API

TMaher13 commented 5 years ago

@chunfuchen Following that issue and the version environment you used (Qiskit 10.4, qiskit-ibmq-provider 0.2.2, etc), I get a bunch of status 403 codes. I saw on the slack channel a couple people were saying that qiskit is doing away with the credit system though? This is the error message I'm getting:

Got a 403 code response to /api/Network/ibm-q/Groups/open/Projects/main/jobs: {"error":{"statusCode":403,"name":"NOT_CREDITS_AVALIABLES","message":"NOT_CREDITS_AVALIABLES","code":"NOT_CREDITS_AVALIABLES"}} FAILURE: Can not get job id, Resubmit the qobj to get job id.Error: Got a 403 code response to /api/Network/ibm-q/Groups/open/Projects/main/jobs: {"error":{"statusCode":403,"name":"NOT_CREDITS_AVALIABLES","message":"NOT_CREDITS_AVALIABLES","code":"NOT_CREDITS_AVALIABLES"}}

chunfuchen commented 5 years ago

May I know how do you enable your accounts? Furthermore, from the message you get, you might submit too many jobs, do you mind waiting a while and try again later? Thanks.

TMaher13 commented 5 years ago

IBMQ.enable_account(token, url='https://api.quantum-computing.ibm.com/api/Hubs/ibm-q/Groups/open/Projects/main')

Where 'token' is the string of my API token taken from my IBM Q account. It finishes after a while of giving me the status 403 codes if I just let it run, same as the 400 codes

chunfuchen commented 5 years ago

Hi, I will only get 403 error (about do not have enough credits) after using new API, I had let my job run few hours but still get 403 error only. Do you mind posting the error message after you switch to new API? Thanks

TMaher13 commented 5 years ago

By new API do you mean updating qiskit-aqua to 0.5.2 from 0.5.1? I updated qiskit-aqua and then ran my code again. It gave the 403 code for about 30 minutes then gave me the results.

chunfuchen commented 5 years ago

the new API I mean using this url 'https://api.quantum-computing.ibm.com/api/Hubs/ibm-q/Groups/open/Projects/main'

Encounter 403 error code is normal since you did not have enough credit, you need to wait until you have enough credits. Do you still encounter the 400 error?

TMaher13 commented 5 years ago

I don't receive the 400 error anymore, but I still get the 403 error even after I waited 24 hours to run something. I ran the same code on a different IBM Q account that has not ran anything in several days, and it still got stuck on the 403 error.

We ran on ibmqx2 as well to see if it's an issue with the specific melbourne backend, but got the same result.

chunfuchen commented 5 years ago

@TMaher13 do you see any job is launched at this page? https://quantum-computing.ibm.com/results

You can consider the 400 error of old API is similar to the 403 error of new API.

TMaher13 commented 5 years ago

@chunfuchen My page shows that my jobs submitted all had completed, even though some of them never returned the results to me.

The account column is blank for all jobs though, could that be why? That seems odd since I use the IBMQ.enable_account(token, uri) API call.

chunfuchen commented 5 years ago

@chunfuchen My page shows that my jobs submitted all had completed, even though some of them never returned the results to me.

So some jobs are completed but Aqua keeps returning you 403 error? If so, I will try to reproduce and fix it. Or you do not see any job after you encounter 403 error?

For me, after I encounter 403 error, then I will keep getting 403 error and no job is submitted (no new job are pending in the dashboard). I need to wait until my credit is enough and then try again later.

The account column is blank for all jobs though, could that be why? That seems odd since I use the IBMQ.enable_account(token, uri) API call.

I think blank column for the account is okay.

TMaher13 commented 5 years ago

The jobs that I submit show up even when I encounter the 403 error, and sometimes it shows multiple result IDs for each job I submit.

I just attempted to submit a job using the same code for the first time in 3 days and still get the 403 error. When I look on the API dashboard, I see 9 unique IDs for my job all saying the status is COMPLETED (they show up in the Pending Results and then Latest Results once they are "finished").

chunfuchen commented 5 years ago

@TMaher13 Thanks. I think there is a bug after switching to the new API. I will try to reproduce and fix it.

chunfuchen commented 5 years ago

After multiple attempts, I still can not see any job in my dashboard (IBMQ website) If I get the 403 error.

Here is my log from Not available credits till successfully submitting jobs.

Got a 403 code response to /api/Network/ibm-q/Groups/open/Projects/main/jobs: {"error":{"statusCode":403,"name":"NOT_CREDITS_AVALIABLES","message":"NOT_CREDITS_AVALIABLES","code":"NOT_CREDITS_AVALIABLES"}}
2019-07-08 15:39:54,331:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Encounter error during submitting the qobj. Will resubmit it. IBMQ api error: Got a 403 code response to /api/Network/ibm-q/Groups/open/Projects/main/jobs: {"error":{"statusCode":403,"name":"NOT_CREDITS_AVALIABLES","message":"NOT_CREDITS_AVALIABLES","code":"NOT_CREDITS_AVALIABLES"}} 
Got a 403 code response to /api/Network/ibm-q/Groups/open/Projects/main/jobs: {"error":{"statusCode":403,"name":"NOT_CREDITS_AVALIABLES","message":"NOT_CREDITS_AVALIABLES","code":"NOT_CREDITS_AVALIABLES"}}
2019-07-08 15:40:00,736:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Encounter error during submitting the qobj. Will resubmit it. IBMQ api error: Got a 403 code response to /api/Network/ibm-q/Groups/open/Projects/main/jobs: {"error":{"statusCode":403,"name":"NOT_CREDITS_AVALIABLES","message":"NOT_CREDITS_AVALIABLES","code":"NOT_CREDITS_AVALIABLES"}} 
Got a 403 code response to /api/Network/ibm-q/Groups/open/Projects/main/jobs: {"error":{"statusCode":403,"name":"NOT_CREDITS_AVALIABLES","message":"NOT_CREDITS_AVALIABLES","code":"NOT_CREDITS_AVALIABLES"}}
2019-07-08 15:40:07,085:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Encounter error during submitting the qobj. Will resubmit it. IBMQ api error: Got a 403 code response to /api/Network/ibm-q/Groups/open/Projects/main/jobs: {"error":{"statusCode":403,"name":"NOT_CREDITS_AVALIABLES","message":"NOT_CREDITS_AVALIABLES","code":"NOT_CREDITS_AVALIABLES"}} 
Got a 403 code response to /api/Network/ibm-q/Groups/open/Projects/main/jobs: {"error":{"statusCode":403,"name":"NOT_CREDITS_AVALIABLES","message":"NOT_CREDITS_AVALIABLES","code":"NOT_CREDITS_AVALIABLES"}}
2019-07-08 15:40:13,922:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Encounter error during submitting the qobj. Will resubmit it. IBMQ api error: Got a 403 code response to /api/Network/ibm-q/Groups/open/Projects/main/jobs: {"error":{"statusCode":403,"name":"NOT_CREDITS_AVALIABLES","message":"NOT_CREDITS_AVALIABLES","code":"NOT_CREDITS_AVALIABLES"}} 
2019-07-08 15:40:21,831:qiskit.aqua.utils.run_circuits:INFO: Backend status: BackendStatus(backend_name='ibmqx4', backend_version='1.0.0', operational=True, pending_jobs=4, status_msg='active')
2019-07-08 15:40:21,832:qiskit.aqua.utils.run_circuits:INFO: There are 1 jobs are submitted.
2019-07-08 15:40:21,833:qiskit.aqua.utils.run_circuits:INFO: All job ids:
['5d239c2667f6530011105679']
2019-07-08 15:40:21,833:qiskit.aqua.utils.run_circuits:INFO: Running 0-th qobj, job id: 5d239c2667f6530011105679
2019-07-08 15:43:25,460:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 0-th qobj, job id: 5d239c2667f6530011105679
2019-07-08 15:43:25,461:qiskit.aqua.algorithms.many_sample.qsvm.qsvm:DEBUG: Calculating overlap:
|██████████████████████████████████████████████████| 6/6 [00:00:00:00]
2019-07-08 15:43:25,609:qiskit.aqua.utils.qp_solver:DEBUG: Solving QP problem is completed.
2019-07-08 15:43:25,611:qiskit.aqua.algorithms.many_sample.qsvm.qsvm:DEBUG: Building circuits:
|██████████████████████████████████████████████████| 8/8 [00:00:00:00]
2019-07-08 15:43:30,271:qiskit.aqua.utils.run_circuits:INFO: Backend status: BackendStatus(backend_name='ibmqx4', backend_version='1.0.0', operational=True, pending_jobs=4, status_msg='active')
2019-07-08 15:43:30,272:qiskit.aqua.utils.run_circuits:INFO: There are 1 jobs are submitted.
2019-07-08 15:43:30,273:qiskit.aqua.utils.run_circuits:INFO: All job ids:
['5d239ce267f653001110567b']
woodsp-ibm commented 5 years ago

This should no longer occur in Aqua 0.6. Closing, if the problem that you experienced still continues for you either reopen or raise a new issue.

patdenim commented 5 years ago

@chunfuchen Hi, we are experiencing the same problem when using Qsvm as described above : 403 Client Error: Forbidden for url: https://api-qcon.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs?access_token=.... NOT_CREDITS_AVALIABLES, Error code: NOT_CREDITS_AVALIABLES. with Aqua 0.6 :-(

2019-10-04 10:26:25,814:qiskit.aqua.algorithms.many_sample.qsvm.qsvm:DEBUG: Building circuits:
|██████████████████████████████████████████████████| 435/435 [00:00:00:00]
2019-10-04 10:27:28,305:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Error: 403 Client Error: Forbidden for url: https://api-qcon.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs?access_token=.... NOT_CREDITS_AVALIABLES, Error code: NOT_CREDITS_AVALIABLES. 

We are using qiskit 0.12.0 and the following components version image

We're running on Open device (vigo or ourence) and after a chunk of about 280 error messages (NOT_CREDITS_AVALIABLES) that took about 15 minutes, the jobs are successfully executed

2019-10-04 10:40:20,443:qiskit.aqua.utils.run_circuits:WARNING: FAILURE: Can not get job id, Resubmit the qobj to get job id.Error: 403 Client Error: Forbidden for url: https://api-qcon.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs?access_token=.... NOT_CREDITS_AVALIABLES, Error code: NOT_CREDITS_AVALIABLES. 
2019-10-04 10:40:24,393:qiskit.aqua.utils.run_circuits:INFO: Backend status: BackendStatus(backend_name='ibmq_vigo', backend_version='1.0.1', operational=True, pending_jobs=5, status_msg='active')
2019-10-04 10:40:24,393:qiskit.aqua.utils.run_circuits:INFO: There are 6 jobs are submitted.
2019-10-04 10:40:24,393:qiskit.aqua.utils.run_circuits:INFO: All job ids:
['5d97025849e903001915bebf', '5d97025d06da890018816dad', '5d9702615110a30018ef0f93', '5d970266a5fb6b00194d23d9', '5d97026a65da3400187d2d7d', '5d9705765110a30018ef0f94']
2019-10-04 10:40:24,393:qiskit.aqua.utils.run_circuits:INFO: Running 0-th qobj, job id: 5d97025849e903001915bebf
2019-10-04 10:40:26,361:qiskit.aqua.utils.run_circuits:INFO: COMPLETED the 0-th qobj, job id: 5d97025849e903001915bebf
.................................
.................................

I noticed issue https://github.com/Qiskit/qiskit/issues/395 in qiskit referencing "Error msg typo: NOT_CREDITS_AVALIABLES" but seems to be related to the typo only ?? :-)

Patrick