Keras(2.7.0) + TensorFlow(2.6.0) を久しぶりに触ったらimportでAlreadyExistsError: Another metric with the same name already exists. と言われ落ちたのでメモ。
E tensorflow/core/lib/monitoring/collection_registry.cc:77] Cannot register 2 metrics with the same name: /tensorflow/api/keras/optimizers
...
...
tensorflow.python.framework.errors_impl.AlreadyExistsError: Another metric with the same name already exists.
TL;DR
TensorFlow2.6 なら Keras2.6 を使うこと。
pip uninstall keras
pip install keras==2.6.0
理由
Keras2.6 + TensorFlow2.7 はバージョンミスマッチのためNG。
KerasのGitHubのIssueを見ると次のような記述あり。
We believe the Keras 2.7.0 release is getting installed by pip when users install Tensorflow, even though Tensorflow 2.7 hasn’t been released to pip yet. The version mismatch (Keras 2.7 + TF 2.6.1) is probably the cause of the error.