This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
TypeError: JSONDecoder.__init__() got an unexpected keyword argument 'encoding'
#647
Comments
I believe this is the same issue as #528 @antalszava I was unable to replicate the issue with your code snippet - can you post the full error message with a job id? |
Sure! ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[1], line 12
9 backend = provider.get_backend("simulator_statevector")
11 job = execute(circuit, backend)
---> 12 result = job.result()
13 print(result.get_counts())
File ~/anaconda3/lib/python3.10/site-packages/qiskit_ibm_provider/job/ibm_circuit_job.py:242, in IBMCircuitJob.result(self, timeout, refresh)
240 # pylint: disable=arguments-differ
241 if self._result is None or refresh:
--> 242 self.wait_for_final_state(timeout=timeout)
243 if self._status is JobStatus.CANCELLED:
244 raise IBMJobInvalidStateError(
245 "Unable to retrieve result for job {}. "
246 "Job was cancelled.".format(self.job_id())
247 )
File ~/anaconda3/lib/python3.10/site-packages/qiskit_ibm_provider/job/ibm_circuit_job.py:627, in IBMCircuitJob.wait_for_final_state(self, timeout)
624 self._ws_client_future.result(timeout)
625 # poll for status after stream has closed until status is final
626 # because status doesn't become final as soon as stream closes
--> 627 status = self.status()
628 while status not in JOB_FINAL_STATES:
629 elapsed_time = time.time() - start_time
File ~/anaconda3/lib/python3.10/site-packages/qiskit_ibm_provider/job/ibm_circuit_job.py:350, in IBMCircuitJob.status(self)
347 return self._status
349 with api_to_job_error():
--> 350 api_response = self._runtime_client.job_get(self.job_id())["state"]
351 # response state possibly has two values: status and reason
352 # reason is not used in the current interface
353 self._api_status = api_response["status"]
File ~/anaconda3/lib/python3.10/site-packages/qiskit_ibm_provider/api/clients/runtime.py:159, in RuntimeClient.job_get(self, job_id)
150 def job_get(self, job_id: str) -> Dict:
151 """Get job data.
152
153 Args:
(...)
157 JSON response.
158 """
--> 159 response = self._api.program_job(job_id).get()
160 logger.debug("Runtime job get response: %s", response)
161 return response
File ~/anaconda3/lib/python3.10/site-packages/qiskit_ibm_provider/api/rest/program_job.py:56, in ProgramJob.get(self)
50 def get(self) -> Dict:
51 """Return program job information.
52
53 Returns:
54 JSON response.
55 """
---> 56 return self.session.get(self.get_url("self")).json(cls=RuntimeDecoder)
File ~/anaconda3/lib/python3.10/site-packages/requests/models.py:971, in Response.json(self, **kwargs)
968 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
970 try:
--> 971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
File ~/anaconda3/lib/python3.10/site-packages/simplejson/__init__.py:542, in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw)
540 raise TypeError("use_decimal=True implies parse_float=Decimal")
541 kw['parse_float'] = Decimal
--> 542 return cls(encoding=encoding, **kw).decode(s)
File ~/anaconda3/lib/python3.10/site-packages/qiskit_ibm_provider/utils/json.py:264, in RuntimeDecoder.__init__(self, *args, **kwargs)
263 def __init__(self, *args: Any, **kwargs: Any):
--> 264 super().__init__(object_hook=self.object_hook, *args, **kwargs)
265 self.__parameter_vectors: Dict[str, Tuple[ParameterVector, set]] = {}
266 self.__read_parameter_expression = (
267 functools.partial(
268 _read_parameter_expression_v3,
(...)
272 else _read_parameter_expression
273 )
TypeError: JSONDecoder.__init__() got an unexpected keyword argument 'encoding' |
I explained in this comment #649 (comment) but I believe the issue is that you have the |
fixed by #649 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Information
What is the current behavior?
Multiple remote simulators raise a json error:
TypeError: JSONDecoder.__init__() got an unexpected keyword argument 'encoding'
This error comes up for
"ibmq_qasm_simulator"
,"simulator_statevector"
and maybe more.Steps to reproduce the problem
What is the expected behavior?
No error.
Suggested solutions
N/A
The text was updated successfully, but these errors were encountered: