-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
Keras 2.4 release adds dependency on tensorflow>=2.2.0, which breaks earlier installs #14129
Comments
/cc @fchollet |
Thanks for raising this @cliffwoolley. I can confirm this change is incompatible with
|
Incompatibility with |
@fchollet unfortunately your fix won't work to address the issue of What I would suggest is the following:
from distutils.version import LooseVersion
try:
import tensorflow as tf
if LooseVersion(tf.__version__) < LooseVersion("2.2.0"):
raise RuntimeError("Keras requires a version of Tensorflow >= 2.2. Please upgrade")
except ImportError:
raise ImportError("Tensorflow >= 2.2 is not installed. Please run `pip install tensorflow>=2.2`") This will effectively make any installation of Keras to fail on import if the condition on Tensorflow does not a version condition. |
To add on to @DEKHTIARJonathan's suggestion, I think it should be possible to dynamically add
|
@tgaddair so long as keras is shipped as an sdist that will work. Totally agree with you |
Updated to remove the TF requirement and instead run an |
ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow' getting this error after the latest release |
@sb4267 Yes, that is intentional. If you need a TensorFlow version prior to 2.2, you should pin Keras to keras<2.4 . |
7b76bed for Keras 2.4.2 effectively resolves this issue. Explanation: Keras 2.4.0 installation would silently swap out existing TensorFlow installations with TF 2.2, which may be undesirable as discussed above and is why this issue was opened. Starting from Keras 2.4.2, rather than automatically swapping TF versions when installing keras, the new behavior is that Closing. |
thanks for the prompt reply ,
|
@sb4267 Let's handle that outside this issue, please. Maybe a StackOverflow post if you find your combination isn't working? (The above isn't actually enough information to determine this.) |
Yesterday, June 17, Keras 2.4.0 was released. This is the first numbered release since last October (which was 2.3.1).
Keras 2.4 now brings in tensorflow>=2.2 as a dependency (starting from #14121 , which was merged yesterday). It looks like this is because Keras 2.4 basically now redirects to tf.keras.
The problem, however, is one of compatibility: any user workflow that had
pip install keras
or packages that havekeras
in their requirements.txt/setup.py (without pinning to'keras<2.4'
or to some specific earlier version, at least) will now end up replacing existing TensorFlow 1.15 or TensorFlow 2.1 installations (which are the LTS versions as far as I'm aware) with TF 2.2.I'm not quite sure what to suggest should be done as a corrective action at this point; even if this had been numbered as for example, "Keras 3.0" then still packages that don't pin to a particular maximum Keras version would have fallen into this trap.
Already some NVIDIA customers have started hitting this, so I wanted to open the discussion, at least.
The text was updated successfully, but these errors were encountered: