-1

When trying to import tensorflow I get the following error:

  File "E:/Users/jan/Python_Lernen/NN play_data.py", line 2, in <module>
    import tensorflow as tf
  File "E:\Users\jan\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 98, in <module>
    from tensorflow_core import *
  File "E:\Users\jan\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 959, in _find_and_load_unlocked
  File "E:\Users\jan\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "E:\Users\jan\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "E:\Users\jan\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "E:\Users\jan\Anaconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "E:\Users\jan\Anaconda3\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
  File "E:\Users\jan\Anaconda3\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
TypeError: bases must be types

The IDE I'm using is PyCharm Community Edition 2021.1.1 x64. The python version is 3.7.10, tensorflow version is 2.0, cuDNN version is 7.4.2.24, CUDA version is 10.0.

I'm running the same setup at home, without any issues. I've tried reinstalling everything, didn't help.

Does anybody have any ideas?

1 Answer 1

0

It seems that your protobuf version is incompatible with TensorFlow 2.0. You can check if you're using version 3.6.0. If not, try running:

pip uninstall protobuf
pip install protobuf==3.6.0

Then run again your code

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.