Skip to content

Ensure compatible version of numpy in isolated_notebook_test.py#6038

Merged
pavoljuhas merged 2 commits intoquantumlib:masterfrom
pavoljuhas:use-numpy-1.23-in-notebook-tests
Mar 21, 2023
Merged

Ensure compatible version of numpy in isolated_notebook_test.py#6038
pavoljuhas merged 2 commits intoquantumlib:masterfrom
pavoljuhas:use-numpy-1.23-in-notebook-tests

Conversation

@pavoljuhas
Copy link
Copy Markdown
Collaborator

Keep numpy version in the isolated Python environment at 1.23 as
numpy-1.24 is incompatible with cirq and numba.

Fixes stuck notebook tests which import numba.

Related to #5967

Keep numpy version in the isolated Python environment at 1.23
as numpy-1.24 is incompatible with cirq and numba.

Fixes stuck notebook tests which import numba.

Related to quantumlib#5967
@pavoljuhas pavoljuhas requested review from a team, cduck and vtomole as code owners March 14, 2023 23:38
@pavoljuhas pavoljuhas requested a review from viathor March 14, 2023 23:38
@pavoljuhas pavoljuhas added kind/health For CI/testing/release process/refactoring/technical debt items area/notebook-testing labels Mar 14, 2023
@pavoljuhas
Copy link
Copy Markdown
Collaborator Author

ping - can somebody PTAL?

Copy link
Copy Markdown
Collaborator

@viathor viathor left a comment

Choose a reason for hiding this comment

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

This PR LGTM, but as a general reflection: it replicates the constraints in requirements.txt, so I'm wondering whether there is a way to avoid the duplication?

@pavoljuhas
Copy link
Copy Markdown
Collaborator Author

This PR LGTM, but as a general reflection: it replicates the constraints in requirements.txt, so I'm wondering whether there is a way to avoid the duplication?

Ack. To my understanding this list of packages should simulate the jupyter/colab environment of a user running the examples for the first time. The cirq is installed as a part of the notebook execution in that environment later.
As such the package lists can be different.

BTW, the !pip install cirq in the notebook will cause a numpy downgrade to 1.23 per cirq requirements, but the papermill process which executes the notebook seems to already have numpy-1.24 imported by that point.
The combination of import numpy, numba causes a SystemError with numpy-1.24.

@pavoljuhas pavoljuhas merged commit 2c51eca into quantumlib:master Mar 21, 2023
@pavoljuhas pavoljuhas deleted the use-numpy-1.23-in-notebook-tests branch March 21, 2023 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/notebook-testing kind/health For CI/testing/release process/refactoring/technical debt items

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants