TensorFlow-2.12 Version Import Error

hello. When I install python3 on Ubuntu 20.04.6 LTS version and type import tensorflow as tf in terminal, I get the following error message.

First of all, the PC specifications and configured programs installed in Ubuntu.
For stable operation, XMP and overclock were not set on the main board.
There is no ECC function in the memory.

1. PC Specs

  • CPU : Intel 13th i9-13900K
  • RAM : G.SKILL DDR5-51200 32GB x4 (128GB)
  • GPU : NVIDIA RTX-A6000 D6 48GB (x1)
  • SSD : SK Hynix P41 M.2 NVMe 2280 2TB TLC
  • Cooler : NZXT KRAKEN 360 (Liquid)
  • PSU : Seasonic PRIME PX-1600

2. Configurations

  • Ubuntu : 20.04.6 LTS (64bit)
  • Tensorflow : 2.12.0
  • cuDNN : 8.6
  • CUDA : 11.8.89
  • NVIDIA : 520.61.05
  • Python : 3.8.10
  • Compiler : GCC 9.4.0
  • Build tools : Bazel 5.3.0
  • pip / pip3 : 20.0.2


How should I set the TF_ENABLE_ONEDNN_OPTS=0 environment variable here?

Also, why do I need to rebuild TensorFlow?

Is the phrase TF-TRT Warning: Could not find TensorRT just a warning? I wonder if it’s okay to ignore it.

Please let me know if there is any additional information I need to provide.
Thank you for answer.

Hi @dream

Welcome to the TensorFlow Forum!

These are just informational messages or warnings and can be ignored. You can use code below on top of tensorflow import to suppress these messages:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

import tensorflow as tf

You can filter these messages based on its severity level by setting following value where

  • 0(default) - which shows all the log messages Informational (I), Warnings (W) and Error(E)
  • 1: Shows all the Warnings (W) and Error (E) messages
  • 2 : Shows only the Error (E) messages.