qiskit-documentation/docs/api/qiskit/release-notes/0.6.mdx

164 lines
7.4 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: Qiskit 0.6 release notes
description: Changes made in Qiskit 0.6
in_page_toc_max_heading_level: 4
---
# Qiskit 0.6 release notes
## 0.6
<span id="terra-0-6" />
### Terra 0.6
<span id="id604" />
#### Highlights
This release includes a redesign of internal components centered around a new, formal communication format (Qobj), along with long awaited features to improve the user experience as a whole. The highlights, compared to the 0.5 release, are:
* Improvements for inter-operability (based on the Qobj specification) and extensibility (facilities for extending Qiskit with new backends in a seamless way)
* New options for handling credentials and authentication for the IBM Q backends, aimed at simplifying the process and supporting automatic loading of user credentials
* A revamp of the visualization utilities: stylish interactive visualizations are now available for Jupyter users, along with refinements for the circuit drawer (including a matplotlib-based version)
* Performance improvements centered around circuit transpilation: the basis for a more flexible and modular architecture have been set, including parallelization of the circuit compilation and numerous optimizations
<span id="id605" />
#### Compatibility Considerations
Please note that some backwards-incompatible changes have been introduced during this release the following notes contain information on how to adapt to the new changes.
<span id="removal-of-quantumprogram" />
##### Removal of `QuantumProgram`
As hinted during the 0.5 release, the deprecation of the `QuantumProgram` class has now been completed and is no longer available, in favor of working with the individual components (`BaseJob`, `QuantumCircuit`, `ClassicalRegister`, `QuantumRegister`, [`qiskit`](/api/qiskit/0.45/index#module-qiskit "qiskit")) directly.
Please check the [0.5 release notes](./0.5#quantum-program-0-5) and the examples for details about the transition:
```python
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import Aer, execute
q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q, c)
qc.h(q[0])
qc.cx(q[0], q[1])
qc.measure(q, c)
backend = get_backend('qasm_simulator')
job_sim = execute(qc, backend)
sim_result = job_sim.result()
print("simulation: ", sim_result)
print(sim_result.get_counts(qc))
```
<span id="ibm-q-authentication-and-qconfig-py" />
##### IBM Q Authentication and `Qconfig.py`
The managing of credentials for authenticating when using the IBM Q backends has been expanded, and there are new options that can be used for convenience:
1. save your credentials in disk once, and automatically load them in future sessions. This provides a one-off mechanism:
```python
from qiskit import IBMQ
IBMQ.save_account('MY_API_TOKEN', 'MY_API_URL')
```
afterwards, your credentials can be automatically loaded from disk by invoking `load_accounts()`:
```python
from qiskit import IBMQ
IBMQ.load_accounts()
```
or you can load only specific accounts if you only want to use those in a session:
```python
IBMQ.load_accounts(project='MY_PROJECT')
```
2. use environment variables. If `QE_TOKEN` and `QE_URL` is set, the `IBMQ.load_accounts()` call will automatically load the credentials from them.
Additionally, the previous method of having a `Qconfig.py` file in the program folder and passing the credentials explicitly is still supported.
<span id="backends" />
##### Working with backends
A new mechanism has been introduced in Terra 0.6 as the recommended way for obtaining a backend, allowing for more powerful and unified filtering and integrated with the new credentials system. The previous top-level methods `register()`, `available_backends()` and `get_backend()` are still supported, but will deprecated in upcoming versions in favor of using the qiskit.IBMQ and qiskit.Aer objects directly, which allow for more complex filtering.
For example, to list and use a local backend:
```python
from qiskit import Aer
all_local_backends = Aer.backends(local=True) # returns a list of instances
qasm_simulator = Aer.backends('qasm_simulator')
```
And for listing and using remote backends:
```python
from qiskit import IBMQ
IBMQ.enable_account('MY_API_TOKEN')
5_qubit_devices = IBMQ.backends(simulator=True, n_qubits=5)
ibmqx4 = IBMQ.get_backend('ibmqx4')
```
Please note as well that the names of the local simulators have been simplified. The previous names can still be used, but it is encouraged to use the new, shorter names:
| Qiskit Terra 0.5 | Qiskit Terra 0.6 |
| ------------------------------- | ------------------------ |
| local\_qasm\_simulator | qasm\_simulator |
| local\_statevector\_simulator | statevector\_simulator |
| local\_unitary\_simulator\_py | unitary\_simulator |
##### Backend and Job API changes
* Jobs submitted to IBM Q backends have improved capabilities. It is possible to cancel them and replenish credits (`job.cancel()`), and to retrieve previous jobs executed on a specific backend either by job id (`backend.retrieve_job(job_id)`) or in batch of latest jobs (`backend.jobs(limit)`)
* Properties for checking each individual job status (`queued`, `running`, `validating`, `done` and `cancelled`) no longer exist. If you want to check the job status, use the identity comparison against `job.status`:
```python
from qiskit.backends import JobStatus
job = execute(circuit, backend)
if job.status() is JobStatus.RUNNING:
handle_job(job)
```
Please consult the new documentation of the `IBMQJob` class to get further insight in how to use the simplified API.
* A number of members of `BaseBackend` and `BaseJob` are no longer properties, but methods, and as a result they need to be invoked as functions.
| Qiskit Terra 0.5 | Qiskit Terra 0.6 |
| --------------------- | --------------------------------------------- |
| backend.name | backend.name() |
| backend.status | backend.status() |
| backend.configuration | backend.configuration() |
| backend.calibration | backend.properties() |
| backend.parameters | backend.jobs() backend.retrieve\_job(job\_id) |
| job.status | job.status() |
| job.cancelled | job.queue\_position() |
| job.running | job.cancel() |
| job.queued | |
| job.done | |
##### Better Jupyter tools
The new release contains improvements to the user experience while using Jupyter notebooks.
First, new interactive visualizations of counts histograms and quantum states are provided: `plot_histogram()` and `plot_state()`. These methods will default to the new interactive kind when the environment is Jupyter and internet connection exists.
Secondly, the new release provides Jupyter cell magics for keeping track of the progress of your code. Use `%%qiskit_job_status` to keep track of the status of submitted jobs to IBM Q backends. Use `%%qiskit_progress_bar` to keep track of the progress of compilation/execution.
<span id="qiskit-0-5" />