Packaged app cannot import name enum_type_wrapper from google.protobuf.internal

1,379 views
Skip to first unread message

Glenn Ramsey

unread,
Sep 30, 2013, 5:10:05 PM9/30/13
to pyins...@googlegroups.com
Hi,

On OSX I'm getting this error related to google.protobuf when running my
packaged app.

Traceback (most recent call last):
File "<string>", line 11, in <module>
File "/path/to/PyInstaller/loader/pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "/path/to/PyInstaller/build/main/out00-PYZ.pyz/NRT.settings", line 21,
in <module>
File "/path/to/PyInstaller/loader/pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "/path/to/PyInstaller/build/main/out00-PYZ.pyz/NRT.store", line 18, in
<module>
File "/path/to/PyInstaller/loader/pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "/path/to/PyInstaller/build/main/out00-PYZ.pyz/Interface.session_pb2",
line 4, in <module>
ImportError: cannot import name enum_type_wrapper

The line with the error is:

from google.protobuf.internal import enum_type_wrapper

warnmain.txt says it couldn't find the module, although it is there:

...
W: no module named google.protobuf.internal.enum_type_wrapper (top-level import
by Interface.session_pb2)
...

Inspecting the executable with archive_viewer.py shows that the other protobuf
modules were included.

....
'google': (True, 1949646L, 116),
'google.protobuf': (True, 655681L, 125),
'google.protobuf.descriptor': (False, 1533018L, 6556),
'google.protobuf.descriptor_pb2': (False, 1709335L, 5909),
'google.protobuf.internal': (True, 946183L, 134),
'google.protobuf.internal.api_implementation': (False, 2154377L, 427),
'google.protobuf.internal.containers': (False, 1611011L, 3104),
'google.protobuf.internal.cpp_message': (False, 1773364L, 7717),
'google.protobuf.internal.decoder': (False, 1645613L, 6960),
'google.protobuf.internal.encoder': (False, 1840159L, 7145),
'google.protobuf.internal.message_listener': (False, 72422L, 1122),
'google.protobuf.internal.python_message': (False, 913338L, 11694),
'google.protobuf.internal.type_checkers': (False, 1210425L, 2887),
'google.protobuf.internal.wire_format': (False, 26268L, 2846),
'google.protobuf.message': (False, 701961L, 3224),
'google.protobuf.reflection': (False, 2282449L, 1805),
'google.protobuf.text_format': (False, 1656498L, 7313),
...

How do I fix this?

Glenn

Glenn Ramsey

unread,
Sep 30, 2013, 6:10:19 PM9/30/13
to pyins...@googlegroups.com
This is with the latest from the develop branch.

Martin Zibricky

unread,
Oct 1, 2013, 11:56:48 AM10/1/13
to pyins...@googlegroups.com
On Tuesday 01 of October 2013 10:10:05 Glenn Ramsey wrote:
> How do I fix this?

Explicitly import that module in your code?

Glenn Ramsey

unread,
Oct 1, 2013, 5:11:53 PM10/1/13
to pyins...@googlegroups.com
It turned out to be that I had an old version of protobuf that didn't have that
file and it was getting picked up by PyInstaller instead of the right one, but
when I ran the code manually it was getting the newer version.

Reply all
Reply to author
Forward
0 new messages