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

pip install of protobuff causes "ModuleNotFoundError: No module named 'google'" #19234

Open
ScottGibb opened this issue Nov 12, 2024 · 0 comments
Labels
untriaged auto added to all issues by default when created.

Comments

@ScottGibb
Copy link

What version of protobuf and what language are you using?

  • protoc: v28.3
  • protobuf: 5.28.3

What operating system (Linux, Windows, ...) and version?

  • MacOS Sonoma Version 14.7

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

  • Using Python 3.12.7

What did you do?
Steps to reproduce the behavior:

Scotts Code Playground/protobuff test/python via 🐍 v3.13.0 (.venv) on ☁️  (eu-north-1) 
✦ 󰂄 8%python --version
Python 3.12.7

Scotts Code Playground/protobuff test/python via 🐍 v3.13.0 (.venv) on ☁️  (eu-north-1) 
✦ 󰂄 8%python -m venv .venv

Scotts Code Playground/protobuff test/python via 🐍 v3.12.7 (.venv) on ☁️  (eu-north-1) took 4s 
✦ 󰂄 8%source .venv/bin/activate

Scotts Code Playground/protobuff test/python via 🐍 v3.12.7 (.venv) on ☁️  (eu-north-1) 
✦ 󰂄 8%touch main.py

Scotts Code Playground/protobuff test/python via 🐍 v3.12.7 (.venv) on ☁️  (eu-north-1) 
✦ 󰂄 8%pip install protobuf
Collecting protobuf
  Using cached protobuf-5.28.3-cp38-abi3-macosx_10_9_universal2.whl.metadata (592 bytes)
Using cached protobuf-5.28.3-cp38-abi3-macosx_10_9_universal2.whl (414 kB)
Installing collected packages: protobuf
Successfully installed protobuf-5.28.3

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip

Scotts Code Playground/protobuff test/python via 🐍 v3.12.7 (.venv) on ☁️  (eu-north-1) took 2s 
✦ 󰂄 8%pip list
Package  Version
-------- -------
pip      24.2
protobuf 5.28.3

Scotts Code Playground/protobuff test/python via 🐍 v3.12.7 (.venv) on ☁️  (eu-north-1) 
✦ 󰂄 8%protoc --proto_path=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/addressbook.proto

Could not make proto path relative: /addressbook.proto: No such file or directory

Scotts Code Playground/protobuff test/python via 🐍 v3.12.7 (.venv) on ☁️  (eu-north-1) 
✦ 󰂄 8%protoc --proto_path=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/addressbook.proto

Could not make proto path relative: /addressbook.proto: No such file or directory

Scotts Code Playground/protobuff test/python via 🐍 v3.12.7 (.venv) on ☁️  (eu-north-1) 
✦ 󰂄 8%protoc --proto_path=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/addressbook.proto

Could not make proto path relative: /addressbook.proto: No such file or directory

Scotts Code Playground/protobuff test/python via 🐍 v3.12.7 (.venv) on ☁️  (eu-north-1) 
✦ 󰂄 8%protoc --proto_path=./ --python_out=./ addressbook.proto                     


Scotts Code Playground/protobuff test/python via 🐍 v3.12.7 (.venv) on ☁️  (eu-north-1) 
✦ 󰂄 8%python main.py 
Traceback (most recent call last):
  File "/Users/scott.gibb/Documents/Scotts Code Playground/protobuff test/python/main.py", line 1, in <module>
    import addressbook_pb2
  File "/Users/scott.gibb/Documents/Scotts Code Playground/protobuff test/python/addressbook_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
ModuleNotFoundError: No module named 'google'

What did you expect to see

I expected to be able to run the tutorial example: https://protobuf.dev/getting-started/pythontutorial/

What did you see instead?

Couldn't run it, kept complaining bout missing google dependency.

Anything else we should know about your project / environment

Fresh environment, inside a venv. Tried multiple times but no luck :(
I found this on stack overflow but its 9 years out of date:
https://stackoverflow.com/questions/38680593/importerror-no-module-named-google-protobuf

@ScottGibb ScottGibb added the untriaged auto added to all issues by default when created. label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged auto added to all issues by default when created.
Projects
None yet
Development

No branches or pull requests

1 participant