Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Cell not running in "Atoms of Computation" chapter notebook #36

Closed
lainglo opened this issue May 31, 2023 · 3 comments
Closed

Cell not running in "Atoms of Computation" chapter notebook #36

lainglo opened this issue May 31, 2023 · 3 comments

Comments

@lainglo
Copy link

lainglo commented May 31, 2023

Where is the problem?
The issue is in "Quantum States" chapter in the "Atoms of Computation Section" under the "Adding with Qiskit" section.
Here is the link:

https://learn.qiskit.org/course/ch-states/the-atoms-of-computation#adding-qiskit

Relatedly, this can also be seen in input line 15 of the notebook:

https://github.com/Qiskit/textbook/blob/main/notebooks/ch-states/atoms-computation.ipynb

Describe the problem
When trying to run this cell, which includes the command "Assemble", the cell fails and the output returns the following error message:

Traceback (most recent call last):
  Cell In[59], line 2
    counts = sim.run(qobj).result().get_counts()
  File /opt/conda/lib/python3.10/site-packages/qiskit_aer/backends/aerbackend.py:196 in run
    return self._run_qobj(circuits, validate, parameter_binds, **run_options)
TypeError: AerBackend._run_qobj() got multiple values for argument 'parameter_binds'

Use %tb to get the full traceback.
/tmp/ipykernel_103/2201439370.py:2: DeprecationWarning: Using a qobj for run() is deprecated as of qiskit-aer 0.9.0 and will be removed no sooner than 3 months from that release date. Transpiled circuits should now be passed directly using `backend.run(circuits, **run_options).
  counts = sim.run(qobj).result().get_counts()

NOTE: this output is already different from the notebook linked above. In the above notebook link, the output is still displayed. However, when I ran it today on an IBM cloud notebook, there was no output and only the error message.

Expected behavior

This code should return a histogram plot instead of error.

Additional context / references

In order to get the expected behaviour, I followed the advice described in the DeprecationWarning and replaced the code in the original cell, ie

qobj = assemble(qc_ha)
counts = sim.run(qobj).result().get_counts()
plot_histogram(counts)

with

counts = sim.run(qc_ha).result().get_counts()
plot_histogram(counts)
@Raghav-Bell
Copy link
Contributor

Raghav-Bell commented Jun 14, 2023

As per tutorial cell 15 warning assemble is deprecated in qiskit-aer >=0.9.0. Instead use

backend=Aer.get_backend("qasm_simulator") # You can change the simulator to other.
job=execute(qc_ha,backend=backend, shots=1024) # shots are optional
result=job.result()
counts=result.get_counts(qc_ha)
plot_histogram(counts)

Also your textbook link is not working replace it with textbook_link

@frankharkins
Copy link
Member

Sorry I missed this. For some reason, the URL changed to https://learn.qiskit.org/course/ch-states/atoms-computation. As for the code, you can get it working by installing the package versions listed at the bottom of the page

!pip install qiskit-terra==0.18.2 \
qiskit-aer==0.9.0 \
qiskit-ignis==0.6.0 \
qiskit-ibmq-provider==0.16.0 \
qiskit-aqua==0.9.5 \
qiskit==0.30.0 \
qiskit-nature==0.2.1 \
qiskit-finance==0.2.1 \
qiskit-optimization==0.2.2 \
qiskit-machine-learning==0.2.1

@frankharkins
Copy link
Member

The textbook is being superseded and as such this will not be fixed.

@frankharkins frankharkins closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants