Skip to content
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

Add option to retrieve stored ibm credentials #799 #1136

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

natibek
Copy link
Contributor

@natibek natibek commented Dec 30, 2024

Adds the option to retrieve stored ibm credentials (#799) by either:

  1. setting the use_stored_ibm_credentials parameter to True or
  2. passing an IBMProvider() object instance to the ibmq_provider parameter.

First the use_stored_ibm_credentials flag is checked then whether an ibmq_provider is provided. Finally, if neither are set, checks if ibmq_token, ibmq_instance, and ibmq_channel have been set manually.

@@ -1,4 +1,5 @@
numpy>=1.21.0
pydantic>=1.10.7
qiskit-ibm-provider==0.11.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two thoughts:

  1. unfortunately this package has been deprecated, we should be using qiskit-ibm-runtime instead
  2. we don't want qiskit to be a base requirement of general-superstaq. instead maybe we can put this in dev-requirements.txt, and lazy-load it under if use_stored_ibmq_credentials: in superstaq_client (and if it isn't installed raise an error saying that the package is required to load configs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I was wondering why the repository was archived. Makes sense :).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. ... lazy-load it under if use_stored_ibmq_credentials: in superstaq_client (and if it isn't installed raise an error saying that the package is required to load configs)

Would this be a valid application of gss.SuperstaqException?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think in this case i'd just go with ModuleNotFoundError

if ibmq_channel:
kwargs["ibmq_channel"] = ibmq_channel

if use_stored_ibmq_credentials:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qiskit runtime allows multiple accounts to be saved to be saved under different names, so we might want to add an argument to allow users to specify an ibmq_name too?

kwargs["ibmq_channel"] = ibmq_channel

if use_stored_ibmq_credentials:
ibmq_provider = IBMProvider()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for runtime i think this will be something like

Suggested change
ibmq_provider = IBMProvider()
ibmq_account = qiskit_ibm_runtime.accounts.AccountManager.get(
channel=ibmq_channel, name=ibmq_name
)

qiskit runtime allows multiple accounts to be saved to be saved under different names, so we might want to add an argument to allow users to specify an ibmq_name too?

@natibek
Copy link
Contributor Author

natibek commented Jan 8, 2025

@richrines1,

The user requested pydantic==1.10.7
    checks-superstaq 0.5.33 depends on pydantic>=1.10.7
    qiskit-ibm-runtime 0.34.0 depends on pydantic<2.10 and >=2.5.0

should I change the qiskit-ibm-runtime version? Would removing the requirement for the version let pip install a version that does not cause conflicts?

@richrines1
Copy link
Contributor

should I change the qiskit-ibm-runtime version? Would removing the requirement for the version let pip install a version that does not cause conflicts?

not 100% sure it will work but try qiskit-ibm-runtime>=0.21.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants