• This repository has been archived on 28/Jul/2023
  • Stars
    star
    242
  • Rank 167,048 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Qiskit Provider for accessing the quantum devices and simulators at IBM Quantum.

Qiskit IBM Quantum Provider (NOW DEPRECATED)

LicenseBuild Status


PLEASE NOTE: As of version 0.20.0, released in January 2023, qiskit-ibmq-provider has been deprecated with its support ending and eventual archival being no sooner than 3 months from that date. The function provided by qiskit-ibmq-provider is not going away rather it has being split out to separate repositories. Please see the Migration Guides section below for more detail. We encourage you to migrate over at your earliest convenience.


Qiskit is an open-source SDK for working with quantum computers at the level of circuits, algorithms, and application modules.

This module contains a provider that allows accessing the IBM Quantum systems and simulators.

Migration Guides

All the functionality that qiskit-ibmq-provider provides has been migrated to other packages:

Formerly Current package Details Migration Guide
qiskit.providers.ibmq.experiment qiskit-ibm-experiment
(docs)
For the features related with the IBM Quantum experiment database service. guide
qiskit.providers.ibmq.runtime qiskit-ibm-runtime
(docs)
Use this package if you prefer getting high quality probability distribution or expectation values without having to optimize the circuits or mitigate results yourself. guide
Rest of qiskit.providers.ibmq qiskit-ibm-provider
(docs)
Use this package if you need direct access to the backends to do experiments like device characterization. guide

These packages can be installed by themselves (via the standard pip install command, e.g. pip install qiskit-ibm-provider) and are not part of the Qiskit metapackage.

Installation

We encourage installing Qiskit via the PIP tool (a python package manager), which installs all Qiskit elements and components, including this one.

pip install qiskit

PIP will handle all dependencies automatically for us and you will always install the latest (and well-tested) version.

To install from source, follow the instructions in the contribution guidelines.

Setting up the IBM Quantum Provider

Once the package is installed, you can access the provider from Qiskit.

Note: Since November 2019 (and with version 0.4 of this qiskit-ibmq-provider package / version 0.14 of the qiskit package) legacy Quantum Experience or QConsole (v1) accounts are no longer supported. If you are still using a v1 account, please follow the steps described in update instructions to update your account.

Configure your IBM Quantum credentials

  1. Create an IBM Quantum account or log in to your existing account by visiting the IBM Quantum login page.

  2. Copy (and/or optionally regenerate) your API token from your IBM Quantum account page.

  3. Take your token from step 2, here called MY_API_TOKEN, and run:

    from qiskit import IBMQ
    IBMQ.save_account('MY_API_TOKEN')

    The command above stores your credentials locally in a configuration file called qiskitrc. By default, this file is located in $HOME/.qiskit, where $HOME is your home directory. If you are still using Qconfig.py, please delete that file and run the command above.

Accessing your IBM Quantum backends

After calling IBMQ.save_account(), your credentials will be stored on disk. Once they are stored, at any point in the future you can load and use them in your program simply via:

from qiskit import IBMQ

provider = IBMQ.load_account()
backend = provider.get_backend('ibmq_qasm_simulator')

Alternatively, if you do not want to save your credentials to disk and only intend to use them during the current session, you can use:

from qiskit import IBMQ

provider = IBMQ.enable_account('MY_API_TOKEN')
backend = provider.get_backend('ibmq_qasm_simulator')

By default, all IBM Quantum accounts have access to the same, open project (hub: ibm-q, group: open, project: main). For convenience, the IBMQ.load_account() and IBMQ.enable_account() methods will return a provider for that project. If you have access to other projects, you can use:

provider_2 = IBMQ.get_provider(hub='MY_HUB', group='MY_GROUP', project='MY_PROJECT')

Updating to the new IBM Quantum

Since November 2019 (and with version 0.4 of this qiskit-ibmq-provider package), the IBM Quantum Provider only supports the new IBM Quantum, dropping support for the legacy Quantum Experience and Qconsole accounts. The new IBM Quantum is also referred as v2, whereas the legacy one and Qconsole as v1.

This section includes instructions for updating your accounts and programs. Please note that:

  • the IBM Quantum Experience v1 credentials and the programs written for pre-0.3 versions will still be working during the 0.3.x series. From 0.4 onwards, only v2 credentials are supported, and it is recommended to upgrade in order to take advantage of the new features.
  • updating your credentials to the IBM Quantum v2 implies that you will need to update your programs. The sections below contain instructions on how to perform the transition.

Updating your IBM Quantum credentials

If you have credentials for the legacy Quantum Experience or Qconsole stored in disk, you can make use of IBMQ.update_account() helper. This helper will read your current credentials stored in disk and attempt to convert them:

from qiskit import IBMQ

IBMQ.update_account()
Found 2 credentials.
The credentials stored will be replaced with a single entry with token "MYTOKEN"
and the new IBM Quantum v2 URL (https://auth.quantum-computing.ibm.com/api).

In order to access the provider, please use the new "IBMQ.get_provider()" methods:

  provider0 = IBMQ.load_account()
  provider1 = IBMQ.get_provider(hub='A', group='B', project='C')

Note you need to update your programs in order to retrieve backends from a
specific provider directly:

  backends = provider0.backends()
  backend = provider0.get_backend('ibmq_qasm_simulator')

Update the credentials? [y/N]

Upon confirmation, your credentials will be overwritten with a valid IBM Quantum v2 set of credentials. For more complex cases, consider deleting your previous credentials via IBMQ.delete_accounts() and follow the instructions in the IBM Quantum account page.

Updating your programs

The new IBM Quantum support also introduces a more structured approach for accessing backends. Previously, access to all backends was centralized through:

IBMQ.backends()
IBMQ.get_backend('ibmq_qasm_simulator')

In version 0.3 onwards, the preferred way to access the backends is via a Provider for one of your projects instead of via the global IBMQ instance directly, allowing for more granular control over the project you are using:

my_provider = IBMQ.get_provider()
my_provider.backends()
my_provider.get_backend('ibmq_qasm_simulator')

In a similar spirit, you can check the providers that you have access to via:

IBMQ.providers()

In addition, since the new IBM Quantum provides only one set of credentials, the account management methods in IBMQ are now in singular form. For example, you should use IBMQ.load_account() instead of IBMQ.load_accounts(). An IBMQAccountError exception is raised if you attempt to use the legacy methods with an IBM Quantum v2 account.

The following tables contains a quick reference for the differences between the two versions. Please refer to the documentation of each method for more in depth details:

Account management

<0.3 / v1 credentials >=0.3 and v2 credentials
N/A IBMQ.update_account()
IBMQ.save_account(token, url) IBMQ.save_account(token)
IBMQ.load_accounts() provider = IBMQ.load_account()
IBMQ.enable_account() provider = IBMQ.enable_account()
IBMQ.disable_accounts() IBMQ.disable_account()
IBMQ.active_accounts() IBMQ.active_account()
IBMQ.stored_accounts() IBMQ.stored_account()
IBMQ.delete_accounts() IBMQ.delete_account()

Using backends

<0.3 / v1 credentials >=0.3 and v2 credentials
N/A providers = IBMQ.providers()
backend = IBMQ.get_backend(name, hub='HUB') provider = IBMQ.get_provider(hub='HUB')
backend = provider.get_backend(name)
backends = IBMQ.backends(hub='HUB') provider = IBMQ.get_provider(hub='HUB')
backends = provider.backends()

Contribution Guidelines

If you'd like to contribute to IBM Quantum Provider, please take a look at our contribution guidelines. This project adheres to Qiskit's code of conduct. By participating, you are expect to uphold to this code.

We use GitHub issues for tracking requests and bugs. Please use our slack for discussion and simple questions. To join our Slack community use the invite link at Qiskit.org. For questions that are more suited for a forum we use the Qiskit tag in Stack Exchange.

Next Steps

Now you're set up and ready to check out some of the other examples from our Qiskit Tutorial repository.

Authors and Citation

The Qiskit IBM Quantum Provider is the work of many people who contribute to the project at different levels. If you use Qiskit, please cite as per the included BibTeX file.

License

Apache License 2.0.

More Repositories

1

qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
Python
5,189
star
2

qiskit-metapackage

Qiskit is an open-source SDK for working with quantum computers at the level of circuits, algorithms, and application modules.
OpenQASM
3,028
star
3

qiskit-tutorials

A collection of Jupyter notebooks showing how to use the Qiskit SDK
Jupyter Notebook
2,324
star
4

rustworkx

A high performance Python graph library implemented in Rust.
Rust
1,097
star
5

qiskit-aer

Aer is a high performance simulator for quantum circuits that includes noise models
C++
490
star
6

textbook

Source content for the Qiskit Textbook
Jupyter Notebook
349
star
7

qiskit-ibm-runtime

IBM Client for Qiskit Runtime
Python
152
star
8

platypus

Qiskit Textbook (beta)
Jupyter Notebook
134
star
9

ecosystem

The Ecosystem consists of projects, tools, utilities, libraries and tutorials from a broad community of developers and researchers. The goal of the Ecosystem is to recognize, support and accelerate development of quantum technologies using Qiskit.
Python
102
star
10

qiskit.org

The Qiskit official website
TypeScript
101
star
11

qiskit-addon-cutting

Reduce width and depth of quantum circuits by cutting gates and wires.
Python
78
star
12

qiskit-ibm-provider

Qiskit Provider for accessing the IBM Quantum Services: Online Systems and Simulators
Python
77
star
13

qiskit-serverless

A programming model for leveraging quantum and classical resources
Python
67
star
14

feedback

A place to share your feedback on Qiskit; stay up to date with release planning and DemoDays; and find out where to get support
Jupyter Notebook
61
star
15

qiskit-code-assistant-vscode

Simplifying Qiskit to make developing quantum circuits and applications faster
HTML
59
star
16

documentation

The documentation content home for https://docs.quantum.ibm.com.
TypeScript
38
star
17

RFCs

RFCs for changes to Qiskit ecosystem
34
star
18

web-components

Qiskit Web Components
TypeScript
21
star
19

red-queen

Quantum software benchmarking tool
OpenQASM
18
star
20

benchpress

OpenQASM
18
star
21

qiskit-bot

Github bot to automate various aspects of Qiskit development
Python
17
star
22

ibm-quantum-schemas

IBM Quantum API Schemas
Python
16
star
23

qiskit-qasm3-import

Importer from OpenQASM 3 to Qiskit's QuantumCircuit
Python
16
star
24

qiskit-ibm-transpiler

Jupyter Notebook
16
star
25

qiskit_sphinx_theme

A Sphinx theme and documentation guidelines for Qiskit and Qiskit Ecosystem projects
SCSS
15
star
26

openqasm3_parser

Parser and semantic analyzer for the OpenQASM3 language
Rust
11
star
27

qiskit-neko

An integration test suite for Qiskit
Python
10
star
28

saiba

Qiskit Learning
Vue
9
star
29

qiskit-ibm-catalog

Python
6
star
30

gh-actions

Reusable workflows and composite actions
4
star
31

platypus-binder

Repository that handles the binder configuration for platypus
Python
3
star
32

qiskit-addon-dice-solver

2
star
33

qiskit-addon-sqd

2
star
34

qiskit-addon-mpf

2
star
35

qiskit-addon-obp

2
star
36

qiskit-addon-aqc-tensor

Python
1
star
37

qiskit-code-assistant-jupyterlab

1
star
38

qiskit-addon-utils

1
star