Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating docs notebook dependencies + use latest fakebackend #1227

Merged
merged 6 commits into from
Feb 21, 2024

Conversation

david-alber
Copy link
Contributor

Summary

Closes #1224

Making the PR checks stages Test QS on Kubernetes, Notebook LocalProvider tests and Client verify process Qiskit 1.0.0 compatible by updating the dependencies for this stage:

  • omitting deprecated qiskit-ibmq-provider dependency
  • updating qiskit-aer, circuit-knitting-toolbox to latest versions

Using GenericBackendV2 as fake backend as it is Qiskit 1.0.0 compatible, see here.

Details and comments

See failed tests in PR #1205

@david-alber
Copy link
Contributor Author

david-alber commented Feb 19, 2024

@Tansito the Notebook execution fails on LocalProvider (Notebook LocalProvider tests) but passes on ServerlessProvider (Test QS on Kubernetes).
Do you have any idea what needs to be changed to successfully run the Notebook LocalProvider tests stage?
As far as I can see no qiskit-terra dependency is introduced...

@Tansito
Copy link
Member

Tansito commented Feb 19, 2024

Sure, I will take a look as soon as I can, @david-alber 👍

@Tansito
Copy link
Member

Tansito commented Feb 19, 2024

I was taking a look but to be honest I didn't find where the problem could be. @akihikokuroda could you bring us some help here? 4 eyes can see better than two 🙏

In the meantime, @david-alber , could you updated this workflow too?
https://github.com/Qiskit-Extensions/quantum-serverless/blob/main/.github/workflows/kubernetes-deploy.yaml#L64
Just to verify that there is no incompatibility between versions.

@akihikokuroda
Copy link
Collaborator

The difference between LocalProvider tests and Test QS on Kubernetes is the way to install dependency python libraries including qiskit modules. The Test QS Kubernetes specifies and installs them in the workflow file. The LocalProvider does it using the requirement.txt file.

Here is the Test QS Kubernetes workflow

          pip install --no-cache-dir \
            ipywidgets==8.1.0 \
            circuit-knitting-toolbox>=0.6.0 \
            matplotlib==3.7.1 \
            pyscf==2.2.1 \
            scipy==1.10 \
            qiskit-ibm-provider==0.9.0 \
            qiskit-aer==0.13.1 \
            certifi==2023.7.22

here is the contents of the requrements.txt file.

ray[default,data]>=2.9.1, <3
requests>=2.31.0
importlib-metadata>=5.2.0
qiskit>=0.45.2
qiskit-ibm-runtime>=0.18.0
qiskit-ibm-provider>=0.8.0
# TODO: make sure ray node and notebook node have the same version of cloudpickle
cloudpickle==2.2.1
tqdm>=4.65.0
# opentelemetry
opentelemetry-api>=1.18.0
opentelemetry-sdk>=1.18.0
opentelemetry-exporter-otlp-proto-grpc>=1.18.0
s3fs>=2023.6.0
opentelemetry.instrumentation.requests>=0.40b0
ipywidgets>=8.1.1
ipython>=8.10.0

The requirements.txt probably need to be updated.

@david-alber
Copy link
Contributor Author

@akihikokuroda @Tansito As recommended by the Qiskit Migration Guided I checked if the client/requirements.txt introduce a qiskit-terra dependency.
According to my knowledge no qiskit<1 dependency is introduced with the current requirements.
Screenshot 2024-02-20 at 11 22 37

I found it puzzling that the notebooks docs/getting_started/basic/01-03.ipynb ran fine while 04-05 failed even though the LocalProvider is instantiated similarly.

@@ -31,8 +31,8 @@ def test_transpile(self):
circuit1 = random_circuit(5, 3)
circuit2 = random_circuit(5, 3)

backend1 = FakeAlmadenV2()
backend2 = FakeBrooklynV2()
backend1 = GenericBackendV2(num_qubits=5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it matters for these tests, but I found this replacement list for deprecated fake providers, FakeAlmadenV2 is now Fake20QV1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @karlaspuldaro,
I decided to use the GenericBackendV2 because it seems to be the only qiskit.providers.fake_provider that is not a legacy interface.
Do you see an advantage of using Fake20QV1 over GenericBackendV2?
I think either one would be fine 😃.

@akihikokuroda
Copy link
Collaborator

I might find the cause of the error. In the 03_dependencies.ipynb

It specifies additional dependencies for the program.

pattern = QiskitPattern(
    title="pattern-with-dependencies",
    entrypoint="pattern_with_dependencies.py",
    working_dir="./source_files/",
    dependencies=["qiskit-experiments==0.5.2"],
)

The config qiskit-experiments==0.5.2 makes load old package with old dependencies (including qiskit-terra).
Changing 0.5.2 to 0.6.0 seems to fix the issue.

I hope this is it.

@akihikokuroda
Copy link
Collaborator

The additional dependencies are install in the local environment for the LocalProvider. Creating a virtual environment for each job execution in the LocalProvider may be a good enhancement.

@david-alber
Copy link
Contributor Author

I might find the cause of the error. In the 03_dependencies.ipynb

It specifies additional dependencies for the program.

pattern = QiskitPattern(
    title="pattern-with-dependencies",
    entrypoint="pattern_with_dependencies.py",
    working_dir="./source_files/",
    dependencies=["qiskit-experiments==0.5.2"],
)

The config qiskit-experiments==0.5.2 makes load old package with old dependencies (including qiskit-terra). Changing 0.5.2 to 0.6.0 seems to fix the issue.

I hope this is it.

This indeed seems to be it :). Very well spotted @akihikokuroda. Thanks!!!

Copy link
Collaborator

@akihikokuroda akihikokuroda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@david-alber Thanks for your work. LGTM!

Copy link
Member

@Tansito Tansito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much @david-alber , @akihikokuroda , everything looks good to mee too.

Btw @david-alber did you have the opportunity to review @karlaspuldaro comment? In case it would be better to use one or another solution (no problem if you don't know, I can take a look later 😄 )

@david-alber
Copy link
Contributor Author

Thank you so much @david-alber , @akihikokuroda , everything looks good to mee too.

Btw @david-alber did you have the opportunity to review @karlaspuldaro comment? In case it would be better to use one or another solution (no problem if you don't know, I can take a look later 😄 )

@Tansito @karlaspuldaro to be honest I can't say if one or the other is better. To me, it seems that to test the transpiler both would do the job 😇. I chose GenericBackendV2 because it is the only none legacy interface 😅. Any other opinion is much appreciated. I think changing it should not be a problem.

@Tansito
Copy link
Member

Tansito commented Feb 21, 2024

For me your answer is fair enough, @david-alber . Thank you so much for this! ❤️

If there was more doubts @akihikokuroda and I can solve them in another pull request / issue (I will ask internally in any case 😄)

@Tansito Tansito merged commit d5cd4ca into Qiskit:main Feb 21, 2024
15 checks passed
@david-alber
Copy link
Contributor Author

For me your answer is fair enough, @david-alber . Thank you so much for this! ❤️

Feel free to merge it. If there was more doubts @akihikokuroda and I can solve them in another pull request / issue (I will ask internally in any case 😄)

jup sounds good ❤️ 🥳. Thanks y'all for working together on this one 🥂!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make docs Qiskit 1.0.0 compatible
4 participants