protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Import Error: cannot import name '_message' M1 macOS

Open andreeaiulia opened this issue 3 years ago • 5 comments

What version of protobuf and what language are you using? Version: 3.17.3 Language: Python - 3.9.11 and 3.9.7

What operating system (Linux, Windows, ...) and version? macOS Monterey 12.5.1, AppleM1 Pro

What runtime / compiler are you using (e.g., python version or gcc version) Python 3.9.11 and Python 3.9.7 What did you do? Steps to reproduce the behavior:

  1. Create virtual environment pyenv virtualenv 3.9.11 'env-name' pyenv local 'env-name' pip install --upgrade pip pip install wheel export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION="cpp" export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION="2" pip install protobuf==3.17.3

  2. pip install --upgrade --force-reinstall protobuf==3.17.3

Collecting protobuf==3.17.3
   Using cached protobuf-3.17.3-py2.py3-none-any.whl (173 kB)
 Collecting six>=1.9
   Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)

What did you expect to see I am expecting to run without errors

What did you see instead? When I try to run I get the following error:

from google.protobuf.pyext import _message
ImportError: cannot import name '_message' from 'google.protobuf.pyext'

Also '_message.py' file is missing from /google/protobuf/pyext.

I tried the same steps on macOS Big Sur 11.6.8 Intel Core/protobuf 3.17.3/python 3.9.7 and the package installs and there are no errors.

andreeaiulia avatar Aug 23 '22 14:08 andreeaiulia

Same issue for me.

AMontagu avatar Sep 14 '22 12:09 AMontagu

Please upgrade to a newer version. Our setup for cross-compiling the binary wheels has been completely rewritten in 4.21.0 and M1 should work properly now.

haberman avatar Sep 14 '22 15:09 haberman

Strange it was working for me in 3.20.1 and no more for 3.20.2. Maybe it was just an install issue. I fixed the version for now.

Can't upgrade to newer version as grpcio-tools require <4

AMontagu avatar Sep 14 '22 16:09 AMontagu

Ah, sorry I didn't realize this represented a regression from 3.20.1.

An issue has been discovered this morning where none of the binary wheels were released. This is being addressed now.

cc @deannagarcia

haberman avatar Sep 14 '22 16:09 haberman

My bad I didn't give any more details as the issue was still open. Perfect ! Many thanks.

AMontagu avatar Sep 14 '22 16:09 AMontagu

I believe this should be resolved now. Please re-open if it occurs again.

haberman avatar May 26 '23 22:05 haberman