I just got started with Qiskit. When I tried to save my account with the API token from IBMQ website, I got the error: warnings.warn('Credentials already present. Set overwrite=True to overwrite.')
. Then I set overwrite = True
but the warning was still raised and I cannot save the account and connect to the server.
-
$\begingroup$ Welcome to quantum computing SE! I hope you don't mind that I've made slight adjustments to the formatting of the question. If you've got any questions about the site, feel free to take the tour, have a look around Quantum Computing Meta and join us in Quantum Computing Chat $\endgroup$– Mithrandir24601 ♦Feb 21, 2019 at 9:15
2 Answers
Here's some general info, which will hopefully help you find and fix your issue.
You can try using
print(IBMQ.stored_accounts())
to see what accounts you have stored on disk, and maybe see why they aren't working.
To simultaneously sign into all accounts on this list, use
IBMQ.load_accounts()
To only sign into the first, use
token = IBMQ.stored_accounts()[0]['token']
url = IBMQ.stored_accounts()[0]['url']
IBMQ.enable_account(token,url)
To only sign into the second, replace the [0]
above with [1]
, and so on.
To see which accounts you are currently logged into, use
print(IBMQ.active_accounts())
If you want to start afresh by removing all accounts from disk, use
IBMQ.delete_accounts()
Adding new accounts is then done with
IBMQ.save_account(token,url)
Where token is a string that represents your API token, and
url = 'https://quantumexperience.ng.bluemix.net/api'
for those using the public level access.
James Thanks... your suggestion worked, with only exception that now, over the period, commands are updated, like IBMQ.delete_accounts() changed to IBMQ.delete.account() and so on...
See Account Management section in the below link for version "<0.3/v1" vs ">=0.3/v2" credentials:
https://github.com/Qiskit/qiskit-ibmq-provider/#updating-your-ibm-q-experience-credentials