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

dependencies: Update to numpy<1.24.4 #2693

Merged
merged 5 commits into from
Jun 9, 2023

Conversation

jvesely
Copy link
Collaborator

@jvesely jvesely commented Jun 7, 2023

Numpy 1.24 removes few deprecated features and introduces new deprecations;

  • construction of rugged arrays now throws ValueError.
    • Update safe_create_np_array to handle both the original DeprecationWarning and the new ValueError
    • Extract values of all mechanisms in test_save_state_before_simulations to avoid rugged array
  • Conversion from Python integer types warns on range overflow.
    • Switch representation of ctype integers to unsigned. Most uses expect unsigned results.

jvesely and others added 4 commits June 6, 2023 22:40
Numpy 1.24 removed the deprecated feature of creating dtype=object
arrays in:
189eb6e38e78a06d86292b5d503de12fe2bebe38
	("DEP: Finalize ragged array creation deprecation")

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
… homogeneous array

Mechanism values are 2D so we need to index all three results to avoid
rugged array.

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Updates the requirements on [numpy](https://github.com/numpy/numpy) to permit the latest version.
- [Release notes](https://github.com/numpy/numpy/releases)
- [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst)
- [Commits](numpy/numpy@v1.19.0...v1.24.3)

---
updated-dependencies:
- dependency-name: numpy
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
numpy >=1.24 is more sensitive to casting Python integers to numpy ints
with restricted range (e.g. signed vs. unsigned).
Most of our uses expect unsigned integers so switch to respective ctypes
types.

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
@jvesely jvesely added compiler Runtime Compiler deps Dependency update labels Jun 7, 2023
@jvesely jvesely requested a review from kmantel June 7, 2023 20:42
@github-actions
Copy link

github-actions bot commented Jun 7, 2023

This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):

No differences!

...

See CI logs for the full diff.

@github-actions
Copy link

github-actions bot commented Jun 8, 2023

This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):

No differences!

...

See CI logs for the full diff.

# numpy 1.24 removed the above deprecation and raises
# ValueError instead. Note that the below call can still
# raise other ValueErrors
if 'The requested array has an inhomogeneous shape' in str(e):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this getting sent as an np.VisibleDeprecationWarning before? It seems to be what's referenced in https://numpy.org/doc/stable/release/1.24.0-notes.html for ragged arrays, but I don't remember seeing this message before, just the "Creating an ndarray from ragged nested sequences..." one.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Though I see now I referenced this https://numpy.org/neps/nep-0034-infer-dtype-is-object.html in the comment. Maybe I just didn't take note of the message.

Copy link
Collaborator Author

@jvesely jvesely Jun 9, 2023

Choose a reason for hiding this comment

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

I think the wording of the warning was different. the numpy commit (numpy/numpy@189eb6e, clumsily referenced in the commit that adds these lines)
shows that the removed warnings were: "Creating an ndarray from ragged nested sequences ... " and similar. while the remaining error messages are

"setting an array element with a sequence. The "
"requested array has an inhomogeneous shape after "
"%d dimensions. The detected shape was "

@jvesely jvesely merged commit 59b1b20 into PrincetonUniversity:devel Jun 9, 2023
@jvesely jvesely deleted the numpy branch June 9, 2023 01:45
@jvesely jvesely mentioned this pull request Jun 9, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Runtime Compiler deps Dependency update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants