fo40225 / tensorflow-windows-wheel

Tensorflow prebuilt binary for Windows
3.67k stars 1.53k forks source link

google.protobuf.pyext error #171

Closed Bleach665 closed 3 years ago

Bleach665 commented 3 years ago

Windows 10 Enterprise, Python 3.8.7, CUDA 11.1, tensorflow-2.4.0-cp38-cp38-win_amd64.whl. CPU 2x Xeon 5660.

Step to reproduce:

Received errors:

(env) e:\TF>python
Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf;
2021-01-20 18:16:10.043814: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "e:\TF\env\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "e:\TF\env\lib\site-packages\tensorflow\python\__init__.py", line 41, in <module>
    from tensorflow.python.eager import context
  File "e:\TF\env\lib\site-packages\tensorflow\python\eager\context.py", line 32, in <module>
    from tensorflow.core.framework import function_pb2
  File "e:\TF\env\lib\site-packages\tensorflow\core\framework\function_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
  File "e:\TF\env\lib\site-packages\google\protobuf\descriptor.py", line 48, in <module>
    from google.protobuf.pyext import _message
ImportError: cannot import name '_message' from 'google.protobuf.pyext' (e:\TF\env\lib\site-packages\google\protobuf\pyext\__init__.py)

I tried to fix this with setx PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION cpp pip install --upgrade --force-reinstall protobuf, but it didn't help.

Also tried tensorflow-2.3.0-cp38-cp38-win_amd64.whl, but the same error occurred

fo40225 commented 3 years ago

try to use Anaconda3-2020.11

Bleach665 commented 3 years ago

Same error with Anaconda3-2020.11-Windows-x86_64.exe and tensorflow-2.4.0-cp38-cp38-win_amd64.whl.

fo40225 commented 3 years ago

Did you install the tf on base env?

Bleach665 commented 3 years ago

Did you install the tf on base env?

No, I tried in coda created environment conda create -n env python=3.8 and python -m venv env The same error occurs.

In the near future I will try to reproduce this error on a pure virtual machine.

fo40225 commented 3 years ago

If you use a new conda virtual environment, maybe you can try to install protobuf form conda instead of pip.

Or you can try to use tf on base env first to see if it work or not.

Bleach665 commented 3 years ago

If you use a new conda virtual environment, maybe you can try to install protobuf form conda instead of pip. Or you can try to use tf on base env first to see if it work or not.

It didn't help.

I couldn't reproduce this error on a clean virtual machine, so I'm closing this issue.

@fo40225 , thanks for your participation and advice.

Bleach665 commented 3 years ago

For those who come here through the search: Currently, the error described above occurs if an environment variable 'PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION' is set to 'cpp'. Earlier, this variable fixed same issue. Now it on the contrary causes it.