Closed fornasierov closed 1 year ago
Hi @fornasierov, looking at your platform information, you appear to be using iNNvestigate v1.0.9
, a two-year-old release which was based on TF1. This old version of iNNvestigate forces pip to install an old version of Keras.
Updating to iNNvestigate 2, which is based on TF2, should fix your issue. The latest release is v2.0.1
.
When I use pip index versions innvestigate
to show all available versions inside of a Kaggle notebook I get the following:
WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
innvestigate (1.0.9)
Available versions: 1.0.9, 1.0.8
Note: you may need to restart the kernel to use updated packages.
Upon seeing this, I decided to check in my local machine (Pop!_OS 22.04 LTS) and I was able to see the newest versions:
WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
innvestigate (2.0.1)
Available versions: 2.0.1, 2.0.0, 1.0.9, 1.0.8
It was all due to Python 3.7. Although I was using TF 2, the Python version was incompatible with innvestigate 2. See the output of pip install innvestigate==2.0.1
:
ERROR: Ignored the following versions that require a different python version: 2.0.0 Requires-Python >=3.8,<3.11; 2.0.1 Requires-Python >=3.8,<3.11
ERROR: Could not find a version that satisfies the requirement innvestigate==2.0.1 (from versions: 1.0.8, 1.0.9)
ERROR: No matching distribution found for innvestigate==2.0.1
This issue is closed and I was able to make it work. Thank you all!
Thanks for the follow-up, this is very helpful for other people on Python 3.7.
Description
I have a simple conda environment in a Kaggle notebook. This is the
conda list | grep 'tensor\|keras'
output:When I
pip install innvestigate
it downgrades my current Keras version (2.6.0). See:After that, if I repeat
conda list | grep 'tensor\|keras'
I get:As you can see, I have now Keras 2.2.4 together with TensorFlow 2.6.4.
The model I'm working on uses a specific loss function which can be found in the tensorflow_addons.losses module. But after installing innvestigate in my environment, I cannot import tensorflow_addons. See the output of
import tensorflow_addons as tfa
:If I do not install innvestigate and thus do not downgrade Keras from version 2.6.0 to 2.2.4 I'm able to import tensorflow_addons without a problem.
As can be seen in the README from the official tensorflow_addons repository, tensorflow_addons 0.14.0 support TF 2.4, 2.5, 2.6, and I have TF 2.6 installed, so it should work, but because there is a dependency between Keras and Tensorflow, it is not possible to import keras_tensor from keras.engine in Keras version 2.2.4. For instance, if I run
from keras.engine import keras_tensor
in Keras 2.6.0 I get no error.Takeaway
I am opening this as a question because I believe it is necessary to signal to users that downgrading Keras without properly downgrading TF to its compatible version will break some TF model implementations.
I'm hoping to get your opinions on that.
Platform information