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

Import Error: cannot import name '_message' M1 macOS #10443

Closed
andreeaiulia opened this issue Aug 23, 2022 · 6 comments
Closed

Import Error: cannot import name '_message' M1 macOS #10443

andreeaiulia opened this issue Aug 23, 2022 · 6 comments
Assignees
Labels

Comments

@andreeaiulia
Copy link

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 andreeaiulia added the untriaged auto added to all issues by default when created. label Aug 23, 2022
@mcy mcy added python and removed untriaged auto added to all issues by default when created. labels Aug 24, 2022
@AMontagu
Copy link

AMontagu commented Sep 14, 2022

Same issue for me.

@haberman
Copy link
Member

haberman commented Sep 14, 2022

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.

@AMontagu
Copy link

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

@haberman
Copy link
Member

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 haberman reopened this Sep 14, 2022
@AMontagu
Copy link

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

@haberman
Copy link
Member

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

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

No branches or pull requests

4 participants