qiskit-community / qiskit-algorithms

A library of quantum algorithms for Qiskit.
https://qiskit-community.github.io/qiskit-algorithms/
Apache License 2.0
89 stars 43 forks source link

Fix tutorials to work with Qiskit 1.0 #156

Closed woodsp-ibm closed 4 months ago

woodsp-ibm commented 4 months ago

Summary

Qiskit 1,0 removed the deprecated qiskit.tools which included some .jupyter from which the magics that did the version and copyright were imported. This PR adds a local file in the tutorials folder that contains just these magics and changes the import to use this.

Update: more needed fixing after this - see comments below.

Details and comments

woodsp-ibm commented 4 months ago

Seems the notebook that shows VQE with Aer with a noise etc fails now that the magics are fixed

      1 from qiskit_aer.noise import NoiseModel
----> 2 from qiskit.providers.fake_provider import FakeVigo
      4 # fake providers contain data from real IBM Quantum devices stored in Qiskit,
      5 # and are useful for extracting realistic noise models.
      6 device = FakeVigo()

ImportError: cannot import name 'FakeVigo' from 'qiskit.providers.fake_provider' (/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/qiskit/providers/fake_provider/__init__.py)

Will fix/update this

woodsp-ibm commented 4 months ago

I see I need to update the Grover notebook too as this fails since tools is gone

from qiskit.tools.visualization import plot_histogram
coveralls commented 4 months ago

Pull Request Test Coverage Report for Build 7958120916

Details


Files with Coverage Reduction New Missed Lines %
qiskit_algorithms/algorithm_job.py 2 75.0%
qiskit_algorithms/utils/algorithm_globals.py 5 85.71%
<!-- Total: 7 -->
Totals Coverage Status
Change from base Build 7891628732: 0.03%
Covered Lines: 6488
Relevant Lines: 7157

💛 - Coveralls
woodsp-ibm commented 4 months ago

I downloaded the tutorials3.12 and was surprised to see the histogram was not there in the output of 07 grover one - it had worked for me locally under 3.9. But its there in turorials3.8, and we publish docs under 3.8 so I guess its ok. I'll check after this (hopefully) final change to fix styles (just had warnings about iqx saying it was not found) and if its not there I'll raise an issue so perhaps it can be investigated in the future.

Update: In looking more closely, the reason the figure is not there is because nothing actually runs since it depends on a library (tweedledum) that is not installed under 3.12 as requirements-dev limits this.

woodsp-ibm commented 4 months ago

This is good to go now.