問題
以下のURLに記載された通りにコマンドを入力し、Tensorflow2.7.0を実行しましたがうまくいきません。
参考URL:https://www.kkaneko.jp/tools/win/cuda113.html
Build Tools for Visual Studio 2019 とPythonのインストールは完了しています。
「NVIDIA CUDA 11.4 の動作確認のため,TensorFlow 2.8.0 を実行してみる」というステップで
tensorflow2.7.0のバージョンを使用したかったため、以下のコマンドでインストールしました。
cmd
1python -m pip install tensorflow==2.7.0
インストール後、次のコマンドをコマンドプロンプト上で実行したのですが、エラーが出てしまいます。
cmd
1python -c "import tensorflow as tf; print(tf.__version__)"
以下、エラー文です。
cmd
1C:\WINDOWS\system32>python -c "import tensorflow as tf; print(tf.__version__)" 2Traceback (most recent call last): 3 File "<string>", line 1, in <module> 4 File "C:\Program Files\Python39\lib\site-packages\tensorflow\__init__.py", line 41, in <module> 5 from tensorflow.python.tools import module_util as _module_util 6 File "C:\Program Files\Python39\lib\site-packages\tensorflow\python\__init__.py", line 41, in <module> 7 from tensorflow.python.eager import context 8 File "C:\Program Files\Python39\lib\site-packages\tensorflow\python\eager\context.py", line 33, in <module> 9 from tensorflow.core.framework import function_pb2 10 File "C:\Program Files\Python39\lib\site-packages\tensorflow\core\framework\function_pb2.py", line 16, in <module> 11 from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2 12 File "C:\Program Files\Python39\lib\site-packages\tensorflow\core\framework\attr_value_pb2.py", line 16, in <module> 13 from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2 14 File "C:\Program Files\Python39\lib\site-packages\tensorflow\core\framework\tensor_pb2.py", line 16, in <module> 15 from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2 16 File "C:\Program Files\Python39\lib\site-packages\tensorflow\core\framework\resource_handle_pb2.py", line 16, in <module> 17 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2 18 File "C:\Program Files\Python39\lib\site-packages\tensorflow\core\framework\tensor_shape_pb2.py", line 36, in <module> 19 _descriptor.FieldDescriptor( 20 File "C:\Program Files\Python39\lib\site-packages\google\protobuf\descriptor.py", line 560, in __new__ 21 _message.Message._CheckCalledFromGeneratedFile() 22TypeError: Descriptors cannot not be created directly. 23If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. 24If you cannot immediately regenerate your protos, some other possible workarounds are: 25 1. Downgrade the protobuf package to 3.20.x or lower. 26 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower). 27 28More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
やったこと
2.7.0をアンインストール後、urlの例で出されている通りに2.8.0をインストールし直し、実行しましたが
上記に記載した同様のエラー文が表示されました。
cmd
1python -m pip uninstall tensorflow==2.7.0 2・ 3・ 4・ 5python -m pip install tensorflow==2.8.0
以下のコマンドでTensorflow自体はインストールされていることを確認しました。
cmd
1pip3 list
バージョンを指定して実行してみましたが、出力結果がPythonとなってしまいました。
cmd
1C:\WINDOWS\system32>python3 -c "import tensorflow as tf; print(tf.__version__)" 2Python
バージョン
OS:windows10
python3.9.9
CUDA 11.4.4
cuDNN8.2.4
tensorboard 2.8.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.1
tensorflow 2.7.0
tensorflow-estimator 2.7.0
tensorflow-io-gcs-filesystem 0.26.0
keras 2.7.0
Keras-Preprocessing 1.1.2
pip 22.1.1
回答1件
あなたの回答
tips
プレビュー