Qiskit / qiskit-ibm-provider

Qiskit Provider for accessing the IBM Quantum Services: Online Systems and Simulators
https://qiskit.org/ecosystem/ibm-provider/
Apache License 2.0
77 stars 67 forks source link

IBMProvider initialization fails if h/g/p has no backends #500

Closed jyu00 closed 1 year ago

jyu00 commented 1 year ago

Information

What is the current behavior?

IBMProvider() fails with

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/qiskit_ibm_provider/ibm_provider.py", line 184, in __init__
    self._initialize_services()
  File "/usr/local/lib/python3.9/site-packages/qiskit_ibm_provider/ibm_provider.py", line 411, in _initialize_services
    self._backend = IBMBackendService(self, hgp)
  File "/usr/local/lib/python3.9/site-packages/qiskit_ibm_provider/ibm_backend_service.py", line 85, in __init__
    self._initialize_backends()
  File "/usr/local/lib/python3.9/site-packages/qiskit_ibm_provider/ibm_backend_service.py", line 94, in _initialize_backends
    for name, backend in hgp.backends.items():
  File "/usr/local/lib/python3.9/site-packages/qiskit_ibm_provider/hub_group_project.py", line 62, in backends
    self._backends = self._discover_remote_backends()
  File "/usr/local/lib/python3.9/site-packages/qiskit_ibm_provider/hub_group_project.py", line 82, in _discover_remote_backends
    for backend in backends:
TypeError: 'NoneType' object is not iterable

if the particular h/g/p has no backends. In this case the particular one is hub='ibm-q-internal', group='dev-cloud', project='reservations'

Steps to reproduce the problem

Initializing an account with a h/g/p that has no backends.

What is the expected behavior?

IBMProvider() doesn't fail

Suggested solutions

nonhermitian commented 1 year ago

This is also blocking me

johannesgreiner commented 1 year ago

the error seems to come up if there is any h/g/p with no backends associated with the account. I.e. provider = IBMProvider(instance="ibm-q/open/main") fails with the same error, even though the open provider clearly has backends. ( @kt474 FYI)

ehchen commented 1 year ago

While this bug is being addressed, I reverted to version 0.1.0 and confirmed that it's fine.

kt474 commented 1 year ago

Will be fixed by https://github.com/Qiskit/qiskit-ibm-provider/pull/502

taalexander commented 1 year ago

Can confirm I am running into this as well.

johannesgreiner commented 1 year ago

can the fix be made part of a (sub-) release?

kt474 commented 1 year ago

can the fix be made part of a (sub-) release?

Sure, i'll release 0.2.1 today