Fix deprecated np.int aliases in bundled groupy library#1
Open
markfricker wants to merge 1 commit intoNanoscopyAI:mainfrom
Open
Fix deprecated np.int aliases in bundled groupy library#1markfricker wants to merge 1 commit intoNanoscopyAI:mainfrom
markfricker wants to merge 1 commit intoNanoscopyAI:mainfrom
Conversation
NumPy 1.24 (December 2022) removed the np.int, np.float, np.complex
and related aliases for built-in Python types. Any user running
nERdy+ with a current NumPy version encounters an AttributeError on
import, making the package completely unusable.
Changes (all in nERdy+/groupy/garray/):
- C4_array.py, D4_array.py, Z2_array.py, p4_array.py, p4m_array.py:
dtype=np.int → dtype=np.int64
.astype(np.int) → .astype(np.int64)
== np.int / != np.int → == np.int64 / != np.int64
- matrix_garray.py (additional Windows/platform fix):
data.dtype != np.int64
→ not np.issubdtype(data.dtype, np.integer)
np.int64 is the native integer type on Linux/Mac but Windows NumPy
uses np.int32 for default integer arrays, so the strict dtype
equality check raised a spurious ValueError on Windows.
Tested with NumPy 1.26, PyTorch 2.10 (CUDA 12.6), Python 3.12
on Windows 11. CPU and GPU inference both confirmed working.
Ref: https://numpy.org/doc/stable/release/1.24-notes.html
#expired-deprecations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NumPy 1.24 (December 2022) removed the np.int, np.float, np.complex and related aliases for built-in Python types. Any user running nERdy+ with a current NumPy version encounters an AttributeError on import, making the package completely unusable.
Changes (all in nERdy+/groupy/garray/):
C4_array.py, D4_array.py, Z2_array.py, p4_array.py, p4m_array.py:
dtype=np.int → dtype=np.int64
.astype(np.int) → .astype(np.int64)
== np.int / != np.int → == np.int64 / != np.int64
matrix_garray.py (additional Windows/platform fix): data.dtype != np.int64 → not np.issubdtype(data.dtype, np.integer) np.int64 is the native integer type on Linux/Mac but Windows NumPy uses np.int32 for default integer arrays, so the strict dtype equality check raised a spurious ValueError on Windows.
Tested with NumPy 1.26, PyTorch 2.10 (CUDA 12.6), Python 3.12 on Windows 11. CPU and GPU inference both confirmed working.
Ref: https://numpy.org/doc/stable/release/1.24-notes.html
#expired-deprecations