Unable to import keras.models on tensorflow 2.6.0 / jetpack v46

Apologies if this has been solved on another post, but I’ve been trying to get a keras model working on tensorflow v2.6 on my Nano running Jetpack v46.

I followed the instructions at Installing TensorFlow for Jetson Platform :: NVIDIA Deep Learning Frameworks Documentation for python 3.6. Importing tensorflow works fine but when i attempt to import keras models I run into an error - any help would be greatly appreciated!

Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow.keras.models
2021-10-12 14:15:50.080126: E tensorflow/core/lib/monitoring/collection_registry.cc:77] Cannot register 2 metrics with the same name: /tensorflow/api/keras/optimizers
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/api/_v2/keras/__init__.py", line 10, in <module>
    from keras import __version__
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/__init__.py", line 25, in <module>
    from keras import models
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/models.py", line 20, in <module>
    from keras import metrics as metrics_module
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/metrics.py", line 26, in <module>
    from keras import activations
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/activations.py", line 20, in <module>
    from keras.layers import advanced_activations
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/layers/__init__.py", line 23, in <module>
    from keras.engine.input_layer import Input
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/engine/input_layer.py", line 21, in <module>
    from keras.engine import base_layer
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/engine/base_layer.py", line 43, in <module>
    from keras.mixed_precision import loss_scale_optimizer
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/mixed_precision/loss_scale_optimizer.py", line 18, in <module>
    from keras import optimizers
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/optimizers.py", line 26, in <module>
    from keras.optimizer_v2 import adadelta as adadelta_v2
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/optimizer_v2/adadelta.py", line 22, in <module>
    from keras.optimizer_v2 import optimizer_v2
  File "/home/user/code/.venv/lib/python3.6/site-packages/keras/optimizer_v2/optimizer_v2.py", line 37, in <module>
    "/tensorflow/api/keras/optimizers", "keras optimizer usage", "method")
  File "/home/user/code/.venv/lib/python3.6/site-packages/tensorflow/python/eager/monitoring.py", line 361, in __init__
    len(labels), name, description, *labels)
  File "/home/user/code/.venv/lib/python3.6/site-packages/tensorflow/python/eager/monitoring.py", line 135, in __init__
    self._metric = self._metric_methods[self._label_length].create(*args)
tensorflow.python.framework.errors_impl.AlreadyExistsError: Another metric with the same name already exists.
1 Like

Hi,

It’s known that our latest v2.6.0 release has some issue from opening the GPU libraries.
This may also cause some unexpected behavior.

Our internal team is actively working on this issue.
Currently, would you mind using v2.5.0 as a temporal solution?

$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v46 tensorflow==2.5.0+nv21.8

Thanks.

1 Like

Thank you for the heads up that appeared to be the issue. Appreciate the help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.