Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name '_message' from 'google.protobuf.pyext' on windows and python3.8 #7765

Closed
TobKed opened this issue Jul 30, 2020 · 14 comments · Fixed by #8757
Closed
Assignees
Labels

Comments

@TobKed
Copy link

TobKed commented Jul 30, 2020

Problem similar to #5775
I'm working on tests for https://github.com/apache/beam and it fails during importing google.protobuf.pyext._message for mentioned below environment.

What version of protobuf and what language are you using?
Version: 3.12.2/3.12.4
Language: Python

What operating system (Linux, Windows, ...) and version?
Windows Server 2019
10.0.17763
Datacenter

What runtime / compiler are you using (e.g., python version or gcc version)
CPython (3.8.5)

What did you do?

I run github action with tox tests for python3.8 on windows.
Verified on my PC on windows10 as well: import google.protobuf.pyext._message as pyext_message fails.

Traceback (most recent call last):
  File "setup.py", line 274, in <module>
    setuptools.setup(
  File "c:\hostedtoolcache\windows\python\3.8.5\x64\lib\site-packages\setuptools\__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "c:\hostedtoolcache\windows\python\3.8.5\x64\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "c:\hostedtoolcache\windows\python\3.8.5\x64\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "c:\hostedtoolcache\windows\python\3.8.5\x64\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "c:\hostedtoolcache\windows\python\3.8.5\x64\lib\site-packages\setuptools\command\sdist.py", line 44, in run
    self.run_command('egg_info')
  File "c:\hostedtoolcache\windows\python\3.8.5\x64\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\hostedtoolcache\windows\python\3.8.5\x64\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 253, in run
    gen_protos.generate_proto_files()
  File "D:\a\beam\beam\sdks\python\gen_protos.py", line 347, in generate_proto_files
    generate_urn_files(log, out_dir)
  File "D:\a\beam\beam\sdks\python\gen_protos.py", line 66, in generate_urn_files
    import google.protobuf.pyext._message as pyext_message
ModuleNotFoundError: No module named 'google.protobuf.pyext._message'

Place in the code where it is used: https://github.com/apache/beam/blob/631cb81b39d1beaf53e9fd4b9f144e098c2aeace/sdks/python/gen_protos.py#L66

Logs to github action workflow run on my apache/beam frok: https://github.com/TobKed/beam/runs/928788738?check_suite_focus=true#step:7:99

@TobKed TobKed changed the title ImportError: cannot import name '_message' from 'google.protobuf.pyext' ImportError: cannot import name '_message' from 'google.protobuf.pyext' on windows and python3.8 Jul 31, 2020
@kotori2
Copy link

kotori2 commented Jul 31, 2020

same here with Python 3.8.3 and protobuf 3.12.4

@robertwb
Copy link

I'm seeing this with protobuf==3.14.0 and Python 3.9.

@0zero
Copy link

0zero commented Mar 2, 2021

Hi, are there any updates on this... seeing this issue a lot with windows, python3.8+ and protobuf.

@Laurens-T
Copy link

I had the same issue after upgrading from python 3.7 to python 3.9. I was using protobuf==3.14.0 on Mac/Debian.
Updating protobuf to the latest version solved this issue for me.

@dsandbrink
Copy link

This problem still exists on Windows for Python 3.8 and protobuf 3.17.3

@dsandbrink
Copy link

It seems that for Python 2.7, 3.5, 3.6 and 3.7 protobuf is build with the C++ extension and has special wheels for Windows on the PyPI server, e.g. protobuf-3.17.3-cp37-cp37m-win_amd64.whl.

However starting with Python 3.8 the Windows wheels are no longer available, so the installation defaults back to the general wheel protobuf-3.17.3-py2.py3-none-any.whl, which does not contain the extension.

@anandolee
Copy link
Contributor

The windows VM we are using haven't install python 3.8/3.9. Just merged #8757 to install them. Will see if we can push the artifacts to 3.17.3 or need a new release version

@anandolee
Copy link
Contributor

Update: python 3.8/3.9 for windows have released for 3.17.3.
https://pypi.org/project/protobuf/3.17.3/#files

@JimPlayboy
Copy link

I came up with the same problem with protobuf 3.20.3. Reinstall protobuf with a lower version is useful for me. In my case, it is 3.19.6 which is the minimum version required by tensorboard 2.12.2.

@emmanuelajaero
Copy link

Same for I downgraded protobuf
pip install protobuf==3.19.6

@astrojuanlu
Copy link

Experiencing this error with all versions of protobuf, macOS arm64

@przna
Copy link

przna commented Jan 29, 2024

Experiencing this issue with mac m2

@roei3000b
Copy link

roei3000b commented Apr 4, 2024

Me too with mac m2

@toransahu
Copy link

Me too with mac m1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.