Python dependencies for TensorRT container broken

Based on TensorRT | NVIDIA NGC, I am trying to use the TensorRT NGC container. However, I cannot get the Python dependencies installed due to import errors.

Procedure:

docker run --gpus all -it --rm nvcr.io/nvidia/tensorrt:19.09-py3

within the Docker container, run as instructed:

/opt/tensorrt/python/python_setup.sh

Results (only error pasted):

Setting up uff-converter-tf (6.0.1-1+cuda10.1) ...
Traceback (most recent call last):
  File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 18, in <module>
    from tensorflow import GraphDef
ImportError: cannot import name 'GraphDef'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.6/dist-packages/uff/__init__.py", line 2, in <module>
    from uff.converters.tensorflow.conversion_helpers import from_tensorflow  # noqa
  File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 23, in <module>
    https://www.tensorflow.org/install/""".format(err))
ImportError: ERROR: Failed to import module (cannot import name 'GraphDef')

It does work using tag 18.12-py3, although a warning is given that tf.GraphDef is deprecated, please use tf.compat.v1.GraphDef instead.

Hello, this is due uff converter not supporting TF version 2.0. Local workaround is to install tensorflow version 1.15 or 1.14. This will be resolved in a future container.

Why is this not in the container release notes?

Should at least be in the known issues section

1 Like

Hi siegfried,

This issue didn’t appear until after the container was released.

pip install tensorflow (without a version specified) will install the latest stable version of tensorflow, and tensorflow==2.0 came out after the container/release notes were published.

As nworkerxz9q8, this will be fixed in the future by pinning the version to be < 2.0.