qiskit-documentation/docs/api/qiskit/0.41/qiskit.providers.ibmq.IBMQF...

294 lines
14 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: IBMQFactory
description: API reference for qiskit.providers.ibmq.IBMQFactory
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.providers.ibmq.IBMQFactory
---
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
# IBMQFactory
<Class id="qiskit.providers.ibmq.IBMQFactory" isDedicatedPage={true} github="https://github.com/qiskit/qiskit-ibmq-provider/tree/stable/0.20/qiskit/providers/ibmq/ibmqfactory.py" signature="IBMQFactory" modifiers="class">
Bases: `object`
Factory and account manager for IBM Quantum Experience.
IBMQFactory constructor.
## Methods
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
### active\_account
<Function id="qiskit.providers.ibmq.IBMQFactory.active_account" signature="IBMQFactory.active_account()">
Return the IBM Quantum Experience account currently in use for the session.
**Return type**
`Optional`\[`Dict`\[`str`, `str`]]
**Returns**
Information about the account currently in the session.
</Function>
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
### delete\_account
<Function id="qiskit.providers.ibmq.IBMQFactory.delete_account" signature="IBMQFactory.delete_account()" modifiers="static">
Delete the saved account from disk.
**Raises**
* [**IBMQAccountCredentialsNotFound**](qiskit.providers.ibmq.IBMQAccountCredentialsNotFound "qiskit.providers.ibmq.IBMQAccountCredentialsNotFound") If no valid IBM Quantum Experience credentials can be found on disk.
* [**IBMQAccountMultipleCredentialsFound**](qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound "qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound") If multiple IBM Quantum Experience credentials are found on disk.
* [**IBMQAccountCredentialsInvalidUrl**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl") If invalid IBM Quantum Experience credentials are found on disk.
**Return type**
`None`
</Function>
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
### disable\_account
<Function id="qiskit.providers.ibmq.IBMQFactory.disable_account" signature="IBMQFactory.disable_account()">
Disable the account currently in use for the session.
**Raises**
[**IBMQAccountCredentialsNotFound**](qiskit.providers.ibmq.IBMQAccountCredentialsNotFound "qiskit.providers.ibmq.IBMQAccountCredentialsNotFound") If no account is in use for the session.
**Return type**
`None`
</Function>
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
### enable\_account
<Function id="qiskit.providers.ibmq.IBMQFactory.enable_account" signature="IBMQFactory.enable_account(token, url='https://auth.quantum-computing.ibm.com/api', hub=None, group=None, project=None, **kwargs)">
Authenticate against IBM Quantum Experience for use during the session.
<Admonition title="Note" type="note">
With version 0.4 of this `qiskit-ibmq-provider` package, use of the legacy Quantum Experience and Qconsole (also known as the IBM Quantum Experience v1) credentials is no longer supported.
</Admonition>
**Parameters**
* **token** (`str`) IBM Quantum Experience token.
* **url** (`str`) URL for the IBM Quantum Experience authentication server.
* **hub** (`Optional`\[`str`]) Name of the hub to use.
* **group** (`Optional`\[`str`]) Name of the group to use.
* **project** (`Optional`\[`str`]) Name of the project to use.
* **\*\*kwargs**
Additional settings for the connection:
* proxies (dict): proxy configuration.
* verify (bool): verify the servers TLS certificate.
**Return type**
`Optional`\[[`AccountProvider`](qiskit.providers.ibmq.AccountProvider "qiskit.providers.ibmq.accountprovider.AccountProvider")]
**Returns**
If hub, group, and project are specified, the corresponding provider is returned. Otherwise the provider for the open access project is returned.
**Raises**
* [**IBMQAccountError**](qiskit.providers.ibmq.IBMQAccountError "qiskit.providers.ibmq.IBMQAccountError") If an IBM Quantum Experience account is already in use for the session.
* [**IBMQAccountCredentialsInvalidUrl**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl") If the URL specified is not a valid IBM Quantum Experience authentication URL.
* [**IBMQProviderError**](qiskit.providers.ibmq.IBMQProviderError "qiskit.providers.ibmq.IBMQProviderError") If no provider matches the specified criteria, or more than one provider matches the specified criteria.
</Function>
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
### get\_provider
<Function id="qiskit.providers.ibmq.IBMQFactory.get_provider" signature="IBMQFactory.get_provider(hub=None, group=None, project=None)">
Return a provider for a single hub/group/project combination.
**Parameters**
* **hub** (`Optional`\[`str`]) Name of the hub.
* **group** (`Optional`\[`str`]) Name of the group.
* **project** (`Optional`\[`str`]) Name of the project.
**Return type**
[`AccountProvider`](qiskit.providers.ibmq.AccountProvider "qiskit.providers.ibmq.accountprovider.AccountProvider")
**Returns**
A provider that matches the specified criteria.
**Raises**
[**IBMQProviderError**](qiskit.providers.ibmq.IBMQProviderError "qiskit.providers.ibmq.IBMQProviderError") If no provider matches the specified criteria, or more than one provider matches the specified criteria.
</Function>
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
### load\_account
<Function id="qiskit.providers.ibmq.IBMQFactory.load_account" signature="IBMQFactory.load_account()">
Authenticate against IBM Quantum Experience from stored credentials.
**Return type**
`Optional`\[[`AccountProvider`](qiskit.providers.ibmq.AccountProvider "qiskit.providers.ibmq.accountprovider.AccountProvider")]
**Returns**
If the configuration file specifies a default provider, it is returned. Otherwise the provider for the open access project is returned.
**Raises**
* [**IBMQAccountCredentialsInvalidFormat**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidFormat "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidFormat") If the default provider stored on disk could not be parsed.
* [**IBMQAccountCredentialsNotFound**](qiskit.providers.ibmq.IBMQAccountCredentialsNotFound "qiskit.providers.ibmq.IBMQAccountCredentialsNotFound") If no IBM Quantum Experience credentials can be found.
* [**IBMQAccountMultipleCredentialsFound**](qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound "qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound") If multiple IBM Quantum Experience credentials are found.
* [**IBMQAccountCredentialsInvalidUrl**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl") If invalid IBM Quantum Experience credentials are found.
* [**IBMQProviderError**](qiskit.providers.ibmq.IBMQProviderError "qiskit.providers.ibmq.IBMQProviderError") If the default provider stored on disk could not be found.
</Function>
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
### providers
<Function id="qiskit.providers.ibmq.IBMQFactory.providers" signature="IBMQFactory.providers(hub=None, group=None, project=None)">
Return a list of providers, subject to optional filtering.
**Parameters**
* **hub** (`Optional`\[`str`]) Name of the hub.
* **group** (`Optional`\[`str`]) Name of the group.
* **project** (`Optional`\[`str`]) Name of the project.
**Return type**
`List`\[[`AccountProvider`](qiskit.providers.ibmq.AccountProvider "qiskit.providers.ibmq.accountprovider.AccountProvider")]
**Returns**
A list of providers that match the specified criteria.
</Function>
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
### save\_account
<Function id="qiskit.providers.ibmq.IBMQFactory.save_account" signature="IBMQFactory.save_account(token, url='https://auth.quantum-computing.ibm.com/api', hub=None, group=None, project=None, overwrite=False, **kwargs)" modifiers="static">
Save the account to disk for future use.
<Admonition title="Note" type="note">
If storing a default provider to disk, all three parameters hub, group, project must be specified.
</Admonition>
**Parameters**
* **token** (`str`) IBM Quantum Experience token.
* **url** (`str`) URL for the IBM Quantum Experience authentication server.
* **hub** (`Optional`\[`str`]) Name of the hub for the default provider to store on disk.
* **group** (`Optional`\[`str`]) Name of the group for the default provider to store on disk.
* **project** (`Optional`\[`str`]) Name of the project for the default provider to store on disk.
* **overwrite** (`bool`) Overwrite existing credentials.
* **\*\*kwargs**
* proxies (dict): Proxy configuration for the server.
* verify (bool): If False, ignores SSL certificates errors
**Raises**
* [**IBMQAccountCredentialsInvalidUrl**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl") If the url is not a valid IBM Quantum Experience authentication URL.
* [**IBMQAccountCredentialsInvalidToken**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidToken "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidToken") If the token is not a valid IBM Quantum Experience token.
* **IBMQAccountValueError** If only one or two parameters from hub, group, project are specified.
**Return type**
`None`
</Function>
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
### stored\_account
<Function id="qiskit.providers.ibmq.IBMQFactory.stored_account" signature="IBMQFactory.stored_account()" modifiers="static">
List the account stored on disk.
**Return type**
`Dict`\[`str`, `str`]
**Returns**
A dictionary with information about the account stored on disk.
**Raises**
* [**IBMQAccountMultipleCredentialsFound**](qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound "qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound") If multiple IBM Quantum Experience credentials are found on disk.
* [**IBMQAccountCredentialsInvalidUrl**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl") If invalid IBM Quantum Experience credentials are found on disk.
</Function>
<Admonition title="Warning" type="caution">
The package `qiskit-ibmq-provider` is being deprecated and its repo is going to be archived soon. Please transition to the new packages. More information in [https://ibm.biz/provider\_migration\_guide](https://ibm.biz/provider_migration_guide)
</Admonition>
### update\_account
<Function id="qiskit.providers.ibmq.IBMQFactory.update_account" signature="IBMQFactory.update_account(force=False)" modifiers="static">
Interactive helper for migrating stored credentials to IBM Quantum Experience v2.
**Parameters**
**force** (`bool`) If `True`, disable interactive prompts and perform the changes.
**Return type**
`Optional`\[[`Credentials`](qiskit.providers.ibmq.credentials.Credentials "qiskit.providers.ibmq.credentials.credentials.Credentials")]
**Returns**
The credentials for IBM Quantum Experience v2 if updating is successful or `None` otherwise.
</Function>
</Class>