Description of problem: tensorflow2-2.12.0-4.an23.x86_64 版本的tf import失败 Version-Release number of selected component (if applicable): # cat /etc/os-release NAME="Anolis OS" VERSION="23" ID="anolis" VERSION_ID="23" PLATFORM_ID="platform:an23" PRETTY_NAME="Anolis OS 23" ANSI_COLOR="0;31" HOME_URL="https://openanolis.cn/" BUG_REPORT_URL="https://bugzilla.openanolis.cn/" How reproducible: gpu环境: # nvidia-smi Mon Jul 31 16:01:04 2023 +---------------------------------------------------------------------------------------+ | NVIDIA-SMI 530.30.02 Driver Version: 530.30.02 CUDA Version: 12.1 | |-----------------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 Tesla V100-SXM2-16GB On | 00000000:00:08.0 Off | 0 | | N/A 34C P0 40W / 300W| 0MiB / 16384MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+ +---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | No running processes found | +---------------------------------------------------------------------------------------+ 升级rpm包后,import error # python Python 3.10.12 (main, Jun 7 2023, 00:00:00) [GCC 12.2.1 20221121 (Anolis OS 12.2.1-2)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python3.10/site-packages/tensorflow/__init__.py", line 37, in <module> from tensorflow.python.tools import module_util as _module_util File "/usr/lib64/python3.10/site-packages/tensorflow/python/__init__.py", line 36, in <module> from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow File "/usr/lib64/python3.10/site-packages/tensorflow/python/pywrap_tensorflow.py", line 26, in <module> self_check.preload_check() File "/usr/lib64/python3.10/site-packages/tensorflow/python/platform/self_check.py", line 63, in preload_check from tensorflow.python.platform import _pywrap_cpu_feature_guard ImportError: /usr/lib64/python3.10/site-packages/tensorflow/python/platform/../../libtensorflow_cc.so.2: undefined symbol: _ZN10tensorflow10DeviceNameIN5Eigen9GpuDeviceEE5valueE >>> nightly执行的日志如下: [stdlog] 2023-07-27 22:19:48,550 avocado.utils.process INFO | Running 'rpm -q tensorflow2' [stdlog] 2023-07-27 22:19:48,577 avocado.utils.process DEBUG| [stdout] tensorflow2-2.12.0-3.an23.x86_64 [stdlog] 2023-07-27 22:19:48,578 avocado.utils.process INFO | Command 'rpm -q tensorflow2' finished with 0 after 0.027819438s [stdlog] 2023-07-27 22:19:48,579 avocado.utils.process INFO | Running 'yum update tensorflow2 -y' [stdlog] 2023-07-27 22:19:49,078 avocado.utils.process DEBUG| [stdout] Last metadata expiration check: 2:15:25 ago on Thu Jul 27 20:04:24 2023. [stdlog] 2023-07-27 22:19:49,167 avocado.utils.process DEBUG| [stdout] Dependencies resolved. [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] ================================================================================ [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] Package Architecture Version Repository Size [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] ================================================================================ [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] Upgrading: [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] tensorflow2 x86_64 2.12.0-4.an23 AppStream-AI 266 M [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] Transaction Summary [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] ================================================================================ [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] Upgrade 1 Package [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] Total download size: 266 M [stdlog] 2023-07-27 22:19:49,168 avocado.utils.process DEBUG| [stdout] Downloading Packages: [stdlog] 2023-07-27 22:20:11,732 avocado.utils.process DEBUG| [stdout] tensorflow2-2.12.0-4.an23.x86_64.rpm 12 MB/s | 266 MB 00:22 [stdlog] 2023-07-27 22:20:11,734 avocado.utils.process DEBUG| [stdout] -------------------------------------------------------------------------------- [stdlog] 2023-07-27 22:20:11,734 avocado.utils.process DEBUG| [stdout] Total 12 MB/s | 266 MB 00:22 [stdlog] 2023-07-27 22:20:11,735 avocado.utils.process DEBUG| [stdout] Running transaction check [stdlog] 2023-07-27 22:20:11,791 avocado.utils.process DEBUG| [stdout] Transaction check succeeded. [stdlog] 2023-07-27 22:20:11,791 avocado.utils.process DEBUG| [stdout] Running transaction test [stdlog] 2023-07-27 22:20:15,000 avocado.utils.process DEBUG| [stdout] Transaction test succeeded. [stdlog] 2023-07-27 22:20:15,000 avocado.utils.process DEBUG| [stdout] Running transaction [stdlog] 2023-07-27 22:20:18,106 avocado.utils.process DEBUG| [stdout] Preparing : 1/1 [stdlog] 2023-07-27 22:20:27,331 avocado.utils.process DEBUG| [stdout] [stdlog] 2023-07-27 22:20:27,331 avocado.utils.process DEBUG| [stdout] Upgrading : tensorflow2-2.12.0-4.an23.x86_64 1/2 [stdlog] 2023-07-27 22:20:27,413 avocado.utils.process DEBUG| [stdout] [stdlog] 2023-07-27 22:20:27,413 avocado.utils.process DEBUG| [stdout] Cleanup : tensorflow2-2.12.0-3.an23.x86_64 2/2 [stdlog] 2023-07-27 22:20:27,559 avocado.utils.process DEBUG| [stdout] [stdlog] 2023-07-27 22:20:27,559 avocado.utils.process DEBUG| [stdout] Running scriptlet: tensorflow2-2.12.0-3.an23.x86_64 2/2 [stdlog] 2023-07-27 22:20:35,129 avocado.utils.process DEBUG| [stdout] [stdlog] 2023-07-27 22:20:35,130 avocado.utils.process DEBUG| [stdout] Verifying : tensorflow2-2.12.0-4.an23.x86_64 1/2 [stdlog] 2023-07-27 22:20:35,130 avocado.utils.process DEBUG| [stdout] [stdlog] 2023-07-27 22:20:35,130 avocado.utils.process DEBUG| [stdout] Verifying : tensorflow2-2.12.0-3.an23.x86_64 2/2 [stdlog] 2023-07-27 22:20:35,291 avocado.utils.process DEBUG| [stdout] [stdlog] 2023-07-27 22:20:35,291 avocado.utils.process DEBUG| [stdout] [stdlog] 2023-07-27 22:20:35,291 avocado.utils.process DEBUG| [stdout] Upgraded: [stdlog] 2023-07-27 22:20:35,292 avocado.utils.process DEBUG| [stdout] tensorflow2-2.12.0-4.an23.x86_64 [stdlog] 2023-07-27 22:20:35,292 avocado.utils.process DEBUG| [stdout] [stdlog] 2023-07-27 22:20:35,292 avocado.utils.process DEBUG| [stdout] Complete! [stdlog] 2023-07-27 22:20:35,408 avocado.utils.process INFO | Command 'yum update tensorflow2 -y' finished with 0 after 46.828793855s [stdlog] 2023-07-27 22:20:35,408 avocado.utils.process INFO | Running 'python3 ../../../res/ai/tensorflow/tensorflow2_auto_graph.py' [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] Traceback (most recent call last): [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] File "/var/tmp/tone/run/anolis-pkg-tests/tests/ai/tensorflow2/../../../res/ai/tensorflow/tensorflow2_auto_graph.py", line 1, in <module> [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] import tensorflow as tf [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] File "/usr/lib64/python3.10/site-packages/tensorflow/__init__.py", line 37, in <module> [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] from tensorflow.python.tools import module_util as _module_util [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] File "/usr/lib64/python3.10/site-packages/tensorflow/python/__init__.py", line 36, in <module> [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] File "/usr/lib64/python3.10/site-packages/tensorflow/python/pywrap_tensorflow.py", line 26, in <module> [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] self_check.preload_check() [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] File "/usr/lib64/python3.10/site-packages/tensorflow/python/platform/self_check.py", line 63, in preload_check [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] from tensorflow.python.platform import _pywrap_cpu_feature_guard [stdlog] 2023-07-27 22:20:35,741 avocado.utils.process DEBUG| [stderr] ImportError: /usr/lib64/python3.10/site-packages/tensorflow/python/platform/../../libtensorflow_cc.so.2: undefined symbol: _ZN10tensorflow10DeviceNameIN5Eigen9GpuDeviceEE5valueE [stdlog] 2023-07-27 22:20:35,781 avocado.utils.process INFO | Command 'python3 ../../../res/ai/tensorflow/tensorflow2_auto_graph.py' finished with 1 after 0.372346869s [stdlog] 2023-07-27 22:20:35,782 avocado.test ERROR| Steps to Reproduce: 如上 Actual results: import tf失败 Expected results: import tf成功 Additional info:
升级tensorflow2时需要同步升级libtensorflow_framework2。 dnf update libtensorflow_framework2后问题解决。 # rpm -qa | grep tensorflow libtensorflow_framework2-2.12.0-3.an23.x86_64 python3-tensorflow-io-gcs-filesystem-0.32.0-2.an23.x86_64 python3-tensorflow-estimator-2.12.0-1.an23.noarch tensorflow2-2.12.0-4.an23.x86_64
tensorflow2已添加对libtensorflow_framework2的版本依赖。