3
$\begingroup$

I was trying the qiskit Terra tutorial and it seems that the code provided to connect to an actual quantum computer doesn't run properly. With my API token generated and stored into the variable "my_token", I typed :

IBMQ.save_account(my_token)
IBMQ.load_accounts()

and got the following error message :

------------------------------------------------------------------
TypeError                        Traceback (most recent call last)
<ipython-input-21-7eeefb4c8c69> in <module>()
----> 1 IBMQ.save_account(my_token)
      2 IBMQ.load_accounts()

~/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqprovider.py in save_account(self, token, url, overwrite, **kwargs)
    134         """
    135         credentials = Credentials(token, url, **kwargs)
--> 136         store_credentials(credentials, overwrite=overwrite)
    137 
    138     def active_accounts(self):

~/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/credentials/_configrc.py in store_credentials(credentials, overwrite, filename)
    122     # Read the current providers stored in the configuration file.
    123     filename = filename or DEFAULT_QISKITRC_FILE
--> 124     stored_credentials = read_credentials_from_qiskitrc(filename)
    125 
    126     # Check if duplicated credentials are already stored. By convention,

~/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/credentials/_configrc.py in read_credentials_from_qiskitrc(filename)
     61         if 'verify' in single_credentials.keys():
     62             single_credentials['verify'] = bool(single_credentials['verify'])
---> 63         new_credentials = Credentials(**single_credentials)
     64         credentials_dict[new_credentials.unique_id()] = new_credentials
     65 

TypeError: __init__() missing 1 required positional argument: 'token'

Please tell me where I got it wrong.

$\endgroup$
4
$\begingroup$

I was able to reproduce your issue by changing the key a few times... seems to be a bug.

Either way, I was able to resolve my issue by removing the qiskitrc file.

rm ~/.qiskit/qiskitrc (your location may vary)

After that, set the key again and you should be good.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.