Closed DanyaLearning closed 3 months ago
Could you try logging to your IBM quantum dashboard https://quantum.ibm.com/? I recall such problems might arise from the need to accept a new license agreement, so I want to verify this is not the case.
Thank you for the comment! I accepted the new license agreement now. However, I still get the same error. Regenerating the token another time after that didn't resolve the issue either : /
Hi, I am also facing the very same issue. Changing the token does not help at all. I am using python 3.11.9. I am trying to run this cell:
service = QiskitRuntimeService(
channel='ibm_quantum',
instance='ibm-q/open/main',
token='
I had a similar issue right now, which seems to be the result of system-wide token expiration; regenerating the token worked for me, so I'm in the dark as to your problem.
@DanyaLearning note that qiskit-ibm-provider
is deprecated and you should switch to qiskit-ibm-runtime
, but I don't think that's the cause of your problem.
Hello @DanyaLearning and @SrMontesinos01, please contact IBM Quantum Platform support who can better assist you in resolve issues with your accounts. You can find more information on the Support page.
Dear @jyu00, I dont see how this is account specfic, when I use the open access with just my personal account.
Hi @DanyaLearning and @SrMontesinos01 I was able to reproduce the error and figured out what the problem is. This error you have been getting is because you did not provide the citizenship information in IQP. Once you open up the IQP portal you will see a small pop up in the bottom right. To get rid of the 401 error you have to provide the citizenship info and regenerate the API token and use the new token. Let me know if this helps!
Dear @sumit-kale I provided my citizenship information and regenerated the token afterwards. However, the error still persists.
After regenerating your token please save your account using this command with proper credentials!
QiskitRuntimeService.save_account(channel="ibm_quantum", token="<MyToken>", instance='<MyInstance>',set_as_default=True, overwrite=True)
It seems IBMProvider just doesn't work anymore, even with the code provided in the IBM Quantum account portal. The error code 3446 given is misleading and is not helpful information to solve the issue.
However, with QiskitRuntimeService it is possible like this
from qiskit_ibm_runtime import QiskitRuntimeService, Session, Sampler
from qiskit import QuantumCircuit, transpile
service = QiskitRuntimeService(
channel='ibm_quantum',
instance='ibm-q/open/main',
token='my_token'
)
my_backend = service.backend(name='ibm_sherbrooke')
print(my_backend)
sampler = Sampler()
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0,1)
qc.measure_all()
print(qc.draw())
qc = transpile(qc, my_backend)
print(qc.draw())
with Session(service, backend=my_backend) as session:
sampler = Sampler(session=session)
job = sampler.run(qc, shots=1)
print(f"Job ID: {job.job_id()}")
print(f"Job result: {job.result()}")
And the results can be retrieved with
from qiskit_ibm_runtime import QiskitRuntimeService
service = QiskitRuntimeService(
channel='ibm_quantum',
instance='ibm-q/open/main',
token='my_token'
)
job = service.job('my_job')
print(job)
print(job.result().get_counts())
@DanyaLearning as far as I know qiskit_ibm_provider
is deprecated! So that makes sense! Please use qiskit_ibm_runtime
.
Describe the bug
I just try to access a backend with my API token. However I get the following error when calling IBMProvider(token=API_token):
'401 Client Error: Unauthorized for url: https://auth.quantum-computing.ibm.com/api/users/loginWithToken. Login failed., Error code: 3446.'
Steps to reproduce
Run this script
Expected behavior
Get backend object and log in.
Suggested solutions
I dont know tbh! I found another bug report #1491 , which was closed. However, there is no solution offered there, than to wait. I tried regenerating the token aswell. It didnt change the outcome.
Additional Information