简体   繁体   中英

ImportError: cannot import name '_message' from 'google.protobuf.pyext' (c:\programdata\anaconda3\lib\site-packages\google\protobuf\pyext\__init__.py)

I am trying this command(That I don't know what it does: I only following a tutorial):

tensorboard --logdir=/tmp/tensorflow/rnn_words

And get this result:

Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\Scripts\tensorboard.exe\__main__.py", line 5, in <module>
  File "c:\programdata\anaconda3\lib\site-packages\tensorboard\main.py", line 45, in <module>
    from tensorboard import default
  File "c:\programdata\anaconda3\lib\site-packages\tensorboard\default.py", line 34, in <module>
    import tensorflow as tf
  File "c:\programdata\anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "c:\programdata\anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "c:\programdata\anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
  File "c:\programdata\anaconda3\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
ImportError: cannot import name '_message' from 'google.protobuf.pyext' (c:\programdata\anaconda3\lib\site-packages\google\protobuf\pyext\__init__.py)

What does the above command do? Why do I get this error message?

C:\Windows\system32>python --version
Python 3.7.1

C:\Windows\system32>pip install protobuf
Requirement already satisfied: protobuf in c:\programdata\anaconda3\lib\site-packages (3.6.1)
Requirement already satisfied: six>=1.9 in c:\programdata\anaconda3\lib\site-packages (from protobuf) (1.12.0)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\lib\site-packages (from protobuf) (40.6.3)

if you are in mac, please try it pip install --upgrade --force-reinstall protobuf

Works with pip install protobuf==3.14.0 with Python 3.9

You can test with the following:

# python
Python 3.9.13 (main, Aug  2 2022, 11:20:39)
>>> from google.protobuf.pyext.cpp_message import GeneratedProtocolMessageType

Please upgrade protobuf using the following command:

pip3 install --upgrade --force-reinstall protobuf==4.32.2

for me I downgraded protobuf pip install protobuf==3.19.6

According to the resolution of tensorboard issue #1556 , you should also be able to fix your problem by upgrading to tensorboard==1.13.0 (or later).

IMO, this is the cleanest solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question from google.protobuf.pyext import _message ImportError: DLL load failed: The specified procedure could not be found Python protobuf "from google.protobuf.pyext import _message" - "ImportError: DLL load failed: The specified procedure could not be found" ImportError: cannot import name 'TwitterRestPager' from 'TwitterAPI' (C:\Users\My name \Anaconda3\lib\site-packages\TwitterAPI\__init__.py) ImportError: cannot import name 'set_random_seed' from 'tensorflow' (C:\Users\polon\Anaconda3\lib\site-packages\tensorflow\__init__.py) ImportError: cannot import name 'logsumexp' from 'scipy.misc' (C:\Users\firstname.lastname\Anaconda3\lib\site-packages\scipy\misc\__init__.py) ImportError: cannot import name 'doc' from 'pandas.util._decorators' (C:\ProgramData\Anaconda3\lib\site-packages\pandas\util\_decorators.py) ImportError: cannot import name 'Nullable' from 'bokeh.core.properties' (C:\ProgramData\Anaconda3\lib\site-packages\bokeh\core\properties.py) cannot import name 'BisectingKMeans' from 'sklearn.cluster' (C:\Users\Administrator\anaconda3\lib\site-packages\sklearn\cluster\__init__.py) import MySQLdb报错ImportError: cannot import name '_mysql' from 'MySQLdb' (D:\python\lib\site-packages\MySQLdb\__init__.py) importerror: cannot import name 'dump' from 'dump' (~/.local/lib/python3.8/site-packages/dump/__init__.py)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM