rigetti / pyquil

A Python library for quantum programming using Quil.
http://docs.rigetti.com
Apache License 2.0
1.4k stars 341 forks source link

UnknownApiError: Network error communicating with endpoint #541

Closed sumeetkhatri closed 5 years ago

sumeetkhatri commented 6 years ago

For the past week, I have been constantly getting the following error on the QVM:

`UnknownApiError Traceback (most recent call last)

in () ----> 1 minSVD3_2_1,gates_minSVD3_2_1,CSVD3_2_1,GSVD3_2_1,time_totSVD3_2_1,nfevSVD3_2_1=QAQC_optimize_gates(U3_2,3,Alg3_2[0],gates3_2_1,1000,'quantum',display=True,collective=False,slowdown=False,arb_2qubit=False) /home/sumeet/Documents/environment-matrix/optimize_1q_gates_env_mat.py in QAQC_optimize_gates(U, n, sequence, gates_init, max_sweeps, method, display, collective, slowdown, arb_2qubit) 285 #print sweep_order 286 --> 287 gates_check,count=QAQC_sweep_sequence(U,sequence,G[sweep_count-1],n,method,collective,slowdown,sub_sweep_order,arb_2qubit) 288 289 if method=='classical': /home/sumeet/Documents/environment-matrix/environment_matrix.py in QAQC_sweep_sequence(U, sequence, gates, n, method, collective, slowdown, order, arb_2qubit) 162 E=E+10*gates_new[i] 163 else: --> 164 E,count=QAQC_generate_env_matrix(U,sequence,gates_new,i,n,method,arb_2qubit) 165 if slowdown: 166 E=E+gates_new[i] /home/sumeet/Documents/environment-matrix/environment_matrix.py in QAQC_generate_env_matrix(U, sequence, gates, gate, n, method, arb_2qubit) 45 qubits_discard=np.setdiff1d(indices,qubit) 46 if method=='quantum': ---> 47 return partialtrace_U(U_right.H*U*U_left.H,n,list(qubits_discard.astype(int)),20000) 48 elif method=='classical': 49 return np.matrix(TrX(U_right.H*U*U_left.H,list(qubits_discard.astype(int)),list(2*np.ones(n).astype(int)))),0 /home/sumeet/Documents/environment-matrix/unitary_trace.py in partialtrace_U(U, n, sys_discard, num_samples, display) 388 for x in bits: 389 #for alpha in bits: --> 390 mat_elem_Re,mat_elem_Im=generate_matrix_element(x) 391 #print generate_matrix_element.counter 392 for alpha in bits: /home/sumeet/Documents/environment-matrix/unitary_trace.py in generate_matrix_element(x) 364 365 results_Re=qvm.run(p_Re,[i for i in range(k+1)],num_samples) --> 366 results_Im=qvm.run(p_Im,[i for i in range(k+1)],num_samples) 367 368 for (result_Re,result_Im) in zip(results_Re,results_Im): /usr/local/lib/python2.7/dist-packages/pyquil/api/qvm.pyc in run(self, quil_program, classical_addresses, trials, needs_compilation, isa) 134 return job.result() 135 else: --> 136 response = post_json(self.session, self.sync_endpoint + "/qvm", payload) 137 return response.json() 138 /usr/local/lib/python2.7/dist-packages/pyquil/api/_base_connection.pyc in post_json(session, url, json) 86 res = session.post(url, json=json) 87 if res.status_code >= 400: ---> 88 raise parse_error(res) 89 return res 90 /usr/local/lib/python2.7/dist-packages/pyquil/api/_base_connection.pyc in parse_error(res) 103 104 if 'error_type' not in body: --> 105 raise UnknownApiError(str(body)) 106 107 error_type = body['error_type'] UnknownApiError: {u'message': u'Network error communicating with endpoint'} The server has failed to return a proper response. Please describe the problem and copy the above message into a GitHub issue at: https://github.com/rigetticomputing/pyquil/issues` I have seen a similar post about this UnknownApiError, but not exactly this one.
ryankarle commented 5 years ago

Hi @sumeetkhatri, sorry for the late response- this was a recurring issue with our old stack. If you haven't already, please try downloading our Forest SDK here. Please note that we'll be likely updating the package later this week!