Unable to get protobuf 2.6.1 working with python2.7

620 views
Skip to first unread message

Arun Chandrasekaran

unread,
Jan 28, 2015, 8:27:54 AM1/28/15
to prot...@googlegroups.com
Hi,

I am on Ubuntu 14.10 and I'm using protobuf 2.6.1, built from source.

When I try to run the python protobuf tests, I get the below error.

18:44:33 ~/Setup/protobuf-2.6.1/python
$ python setup.py google_test
running google_test
running egg_info
creating protobuf.egg-info
writing requirements to protobuf.egg-info/requires.txt
writing protobuf.egg-info/PKG-INFO
writing namespace_packages to protobuf.egg-info/namespace_packages.txt
writing top-level names to protobuf.egg-info/top_level.txt
writing dependency_links to protobuf.egg-info/dependency_links.txt
writing manifest file 'protobuf.egg-info/SOURCES.txt'
reading manifest file 'protobuf.egg-info/SOURCES.txt'
writing manifest file 'protobuf.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 200, in <module>
    "Protocol Buffers are Google's data interchange format.",
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/test.py", line 142, in run
    self.with_project_on_sys_path(self.run_tests)
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/test.py", line 122, in with_project_on_sys_path
    func()
  File "/home/arun/Setup/protobuf-2.6.1/python/.eggs/google_apputils-0.4.1-py2.7.egg/google/apputils/setup_command.py", line 157, in run_tests
    ok &= self._RunTestModule(file_path)
  File "/home/arun/Setup/protobuf-2.6.1/python/.eggs/google_apputils-0.4.1-py2.7.egg/google/apputils/setup_command.py", line 123, in _RunTestModule
    module = imp.load_module(module_name, *import_tuple)
  File "google/protobuf/internal/symbol_database_test.py", line 36, in <module>
    from google.protobuf import unittest_pb2
ImportError: cannot import name unittest_pb2

Ignoring the above test failure, I did a sudo python setup.py install.

After this, I'm not able to import the generated proto files. Please see below.

msg.proto
message msg {
    required int64 value = 1;
}

$ protoc --version
libprotoc 2.6.1

$ PYTHONPATH=gen python                                                              
Python 2.7.8 (default, Oct 20 2014, 15:05:19) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import msg_pb2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/arun/prototest/gen/msg_pb2.py", line 9, in <module>
    from google.protobuf import symbol_database as _symbol_database
ImportError: cannot import name symbol_database
>>> 

Any idea where I am going wrong?

Thanks,
Arun

Sreeram Boyapati

unread,
Mar 16, 2015, 1:52:57 PM3/16/15
to prot...@googlegroups.com
I have got the same issue. Is there any work around.
After I ignored it. Got an ImportError that
from google.protobuf.pyext import _message not found.

using source from github
Reply all
Reply to author
Forward
0 new messages