2
$\begingroup$

When I access IBM Q backend with qiskit code, an error occurs.

from qiskit import IBMQ 

qt = 'xxxxxxxxx'

IBMQ.save_account(qt)
IBMQ.load_accounts()

The error message is as follows:

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/api/utils.py in obtain_token(self, config)
    135             response.raise_for_status()
--> 136             self.data_credentials = response.json()
    137         except (requests.HTTPError, ValueError) as ex:

/usr/local/oss/anaconda3/lib/python3.6/site-packages/requests/models.py in json(self, **kwargs)
    896                     pass
--> 897         return complexjson.loads(self.text, **kwargs)
    898 

/usr/local/oss/anaconda3/lib/python3.6/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    353             parse_constant is None and object_pairs_hook is None and not kw):
--> 354         return _default_decoder.decode(s)
    355     if cls is None:

/usr/local/oss/anaconda3/lib/python3.6/json/decoder.py in decode(self, s, _w)
    338         """
--> 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    340         end = _w(s, end).end()

/usr/local/oss/anaconda3/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)
    356         except StopIteration as err:
--> 357             raise JSONDecodeError("Expecting value", s, err.value) from None
    358         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

ApiError                                  Traceback (most recent call last)
/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqsingleprovider.py in _authenticate(cls, credentials)
     94 
---> 95     def _discover_remote_backends(self):
     96         """Return the remote backends available.

/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/api/ibmqconnector.py in __init__(self, token, config, verify)
    103         self.req = Request(token, config=config, verify=verify)
--> 104 
    105     def _check_backend(self, backend_name):

/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/api/utils.py in __init__(self, token, config, verify, retries, timeout_interval)
    216                                       proxy_urls=self.proxy_urls,
--> 217                                       ntlm_credentials=self.ntlm_credentials)
    218 

/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/api/utils.py in __init__(self, token, config, verify, proxy_urls, ntlm_credentials)
     67         if token:
---> 68             self.obtain_token(config=self.config)
     69         else:

/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/api/utils.py in obtain_token(self, config)
    137         except (requests.HTTPError, ValueError) as ex:
--> 138             raise ApiError('error during login: %s' % str(ex))
    139 

ApiError: error during login: Expecting value: line 1 column 1 (char 0)

The above exception was the direct cause of the following exception:

ConnectionError                           Traceback (most recent call last)
<ipython-input-9-2e30fdf423aa> in <module>
     11 IBMQ.stored_accounts()
     12 
---> 13 IBMQ.load_accounts()
     14 #IBMQ.enable_account(qt)

/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqprovider.py in load_accounts(self, **kwargs)
    197 
    198     def disable_accounts(self, **kwargs):
--> 199         """Disable accounts in the current session, subject to optional filtering.
    200 
    201         The filter kwargs can be `token`, `url`, `hub`, `group`, `project`.

/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqprovider.py in _append_account(self, credentials)
    277         """
    278         return all(getattr(credentials, key_, None) == value_ for
--> 279                    key_, value_ in filter_dict.items())

/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqsingleprovider.py in __init__(self, credentials, ibmq_provider)
     50         self.credentials = credentials
     51         self._api = self._authenticate(self.credentials)
---> 52         self._ibm_provider = ibmq_provider
     53 
     54         # Populate the list of remote backends.

/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqsingleprovider.py in _authenticate(cls, credentials)
    101         """
    102         ret = OrderedDict()
--> 103         configs_list = self._api.available_backends()
    104         for raw_config in configs_list:
    105             try:

ConnectionError: Couldn't connect to IBMQ server: error during login: Expecting value: line 1 column 1 (char 0)

How can I solve this problem ?

$\endgroup$

1 Answer 1

2
$\begingroup$

You added an "s" in the final.

IBMQ.load_accounts()

The right way is:

IBMQ.load_account()

I hope I could have helped.

$\endgroup$

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.