-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBM quantum API key solution needed #26
Comments
I wrote some documentation in a markdown cell in my own Jupyter Notebook file. I'm not sure how to connect it to this issue, but I'll copy and paste it here. Make sure your IBM Quantum API is activatedIn order to run code on IBM Quantum, we need to connect our code to the IBM Quantum service. This can be accomplished by activating your IBM Quantum API token. In lay terms, an API, or Application Programming Interface, is a bridge that connects two programs. It allows one program to request functions/data from another. In our present case, we want to connect our code written with qiskit to the IBM Quantum systems so that we can implement Bells Inequality on an actual quantum computer. This can be done by including the line "QiskitRuntimeService.save_account(token="YOUR_API_TOKEN", channel="ibm_quantum") after the from qiskit_ibm_runtime import QiskitRuntimeService statement. If the code you're working on is exclusively private and not published anywhere, you can directly copy and paste your token into this line of code. If, however, the code you're using is public, do not do this. Instead, you can use something like Codespace Secrets to initialize your service. You can do that using the following steps (which I took directly from https://github.com/ubsuny/CompPhys/tree/main/qiskit):
You can find your API token in the top right of the screen after by going to ibm.com/quantum and signing in. There's a button that allows you to copy the token to your clipboard. This line only needs to be run once. It will update your local configuration file which holds all of your qiskit and IBM Quantum credentials. On windows the configuration file is usually located at: C:\Users\YourUsername.qiskit\qiskitrc. On Mac it's /home/YourUsername/.qiskit/qiskitrc. Once the configuration file has been updated (i.e. you've run that line of code), you can simply use the line service = QiskitRuntimeService() to set up the connection between your code (qiskit in this case) and IBM Quantum's cloud services. This will work in any python file or github codespace you use. |
That’s perfect, but to add it to the repository please use a pull request. |
Once we've made the codespace secret do we just paste the name of the secret where it says "YOUR_API_TOKEN" and run it? @iglesias-cardinale |
@p-pxmpo you might want to reference the original author @iglesias-cardinale so he gets a notification about your questions |
@p-pxmpo Yes, that's right. If you used the name "IBMQUANTUM" for your codespace secret, your line of code in your codespace should look like this: QiskitRuntimeService.save_account(token="IBMQUANTUM", channel="ibm_quantum") |
Check ubsuny/compphys/qiskit for examples how to generate github secrets to use the IBM quantum computer
Write documentation what an API key is and why publishing it is an issue. See e.g. here: https://cloud.ibm.com/apidocs/quantum-computing
copy necessary files and write a documentation how to use the IBM quantum API key without publishing it.
The text was updated successfully, but these errors were encountered: