Bug 6170 - yum 源提供的tensorflow GPU版本不可用,python import tensorflow 提示ImportError: cannot import name 'builder' from 'google.protobuf.internal'
Summary: yum 源提供的tensorflow GPU版本不可用,python import tensorflow 提示ImportError: cannot im...
Status: RESOLVED INVALID
Alias: None
Product: Anolis OS 23
Classification: Anolis OS
Component: BaseOS Packages (show other bugs) BaseOS Packages
Version: 23.0
Hardware: x86_64 Linux
: P1-Urgent S1-blocker
Target Milestone: ---
Assignee: xuchunmei
QA Contact: bolong_tbl
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-16 14:09 UTC by feitian200603
Modified: 2023-08-17 09:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description feitian200603 alibaba_cloud_group 2023-08-16 14:09:38 UTC
[root@localhost ~]# nvidia-smi
Wed Aug 16 13:15:11 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 T4                        On | 00000000:00:08.0 Off |                    0 |
| N/A   30C    P8                9W /  70W|      2MiB / 15360MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   1  Tesla T4                        On | 00000000:00:09.0 Off |                    0 |
| N/A   30C    P8                9W /  70W|      2MiB / 15360MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+
[root@localhost ~]# pip3 list |grep tensorflow
tensorflow                                     2.12.0
tensorflow-estimator                           2.12.0
tensorflow-io-gcs-filesystem                   0.32.0
[root@localhost ~]# rpm -qa |grep tensorflow
libtensorflow_framework2-2.12.0-6.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-6.an23.x86_64
[root@localhost ~]# 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
2023-08-16 13:56:29.614820: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX512F, in other operations, rebuild TensorFlow with the appropriate compiler flags.
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 37, in <module>
    from tensorflow.python.eager import context
  File "/usr/lib64/python3.10/site-packages/tensorflow/python/eager/context.py", line 28, in <module>
    from tensorflow.core.framework import function_pb2
  File "/usr/lib64/python3.10/site-packages/tensorflow/core/framework/function_pb2.py", line 5, in <module>
    from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/usr/lib/python3.10/site-packages/google/protobuf/internal/__init__.py)
Comment 1 xuchunmei alibaba_cloud_group 2023-08-17 09:28:54 UTC
新建anolis23实例,安装后tensorflow可正常import.
出问题环境上通过pip安装了更低版本的protobuf。