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

Shap not compatible with numpy>=1.24.0 #2911

Closed
vincentl-met opened this issue May 3, 2023 · 5 comments · Fixed by #2943
Closed

Shap not compatible with numpy>=1.24.0 #2911

vincentl-met opened this issue May 3, 2023 · 5 comments · Fixed by #2943

Comments

@vincentl-met
Copy link

Since 1.24.0 numpy removed np.bool which will lead to various errors using shap repository.
On my case I fixed numpy version to 1.23.0 to make it work.

@detrin
Copy link

detrin commented May 3, 2023

I am not sure about the version change in numpy

Here are another problematic lines
https://github.com/slundberg/shap/blob/master/shap/utils/_general.py#L85
https://github.com/slundberg/shap/blob/master/shap/utils/_general.py#L137

THose could be changed to something like following https://github.com/slundberg/shap/blob/master/shap/utils/_general.py#L159

Alias np.float was deprecated in numpy 1.20.0.

@simonangerbauer
Copy link
Contributor

Duplicate ticket #2837
PR that fixes this #1890

@StatMixedML
Copy link

The incompatibility issue with numpy is still present (I am using the git-version of your package)

AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

@AdJasper
Copy link

Replace np.bool by np.bool_ and np.int by np.int_ in all files in the shap package and it will work

tschuelia added a commit to tschuelia/shap-feedstock that referenced this issue May 26, 2023
Shap is currently incompatible with numpy versions >= 1.24.0 (see shap/shap#2911)
@ricardobarroslourenco
Copy link

If the refactoring will take more time, at least it could be versioned a patch for shap with numpy < 1.24.0 as a dependency. This would provide a temporary fix, while the major refacing can be done.

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 a pull request may close this issue.

6 participants