fix(depreciation): np >= 1.20 dtype long is int_ #11625
Open
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.
Motivation
When I was trying to run a small notebook to explore the Obj365 dataset I get an error of a numpy depreciation. Since numpy 1.20, the use of
np.long
is deprecated. https://numpy.org/devdocs/release/1.20.0-notes.html#deprecationsSo I run the following command to get the occurrence of the use of
np.long
in the repo.Modification
This minor commit just rename the
np.long
tonp.int_
.BC-breaking (Optional)
I do not know what is the impact on this change on numpy versions before. My dev env is based on Python 3.10 so it is not compatible with numpy version <= 1.21.1. Although, only concerning this change, I tested on another dev env of mine and there is no problem to use
np.int_
, it is a correct data type for Numpy.Maybe pin the version of numpy prior 1.20.0 in the requirements/build.txt if you do not want to use this commit? So there would not be any depreciation.