MiraldiLab/maxATAC

Numpy compatibility for Tensorflow 2.5 and SHAP in interpreting analysis jobs

Opened this issue · 2 comments

We have this conflict between tensorflow and shap, where tensorflow 2.5 cannot work with numpy >=1.20.0 and shap is compiled with numpy API version 0xe (numpy >=1.20.0 I believe, the current installation of numpy==1.19.5 is with API version 0xd).

import shap
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd

tensorflow/tensorflow#50204

The API version from 1.20.x looks like below:

#define NPY_1_7_API_VERSION 0x00000007
#define NPY_1_8_API_VERSION 0x00000008
#define NPY_1_9_API_VERSION 0x00000008
#define NPY_1_10_API_VERSION 0x00000008
#define NPY_1_11_API_VERSION 0x00000008
#define NPY_1_12_API_VERSION 0x00000008
#define NPY_1_13_API_VERSION 0x00000008
#define NPY_1_14_API_VERSION 0x00000008
#define NPY_1_15_API_VERSION 0x00000008
#define NPY_1_16_API_VERSION 0x00000008
#define NPY_1_17_API_VERSION 0x00000008
#define NPY_1_18_API_VERSION 0x00000008
#define NPY_1_19_API_VERSION 0x00000008
#define NPY_1_20_API_VERSION 0x0000000e (different from previous 1.19.x version)

https://github.com/numpy/numpy/blob/maintenance/1.20.x/numpy/core/include/numpy/numpyconfig.h

As TF 2.9 will be used for public release along with other progresses in model interpreting, we might want to consider re-open this and test the interpreting functionality at some point. It seems the library conflicts have been resolved with TF >=2.7, see tensorflow/tensorflow#50204 (comment).

This problem should be resolved with the following library versions.
tensorflow: 2.12.0
numpy: 1.22.3
shap: 0.29.3
modisco: 0.5.16.3