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

Error running 'python setup.py google_test' on Ubuntu for 2.6.1 release / c++ Python bindings #188

Closed
markfickett opened this issue Feb 2, 2015 · 1 comment

Comments

@markfickett
Copy link

Steps:
Download v2.6.1 from https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
./configure && make && make check && sudo make install
protoc --version reports 2.6.1

The first time I tried to do 'python setup.py build' it failed; I had to install setuptools which I did with:
wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
then I continued with:

python setup.py build
python setup.py google_test
This last step fails with "cannot import name unittest_pb2", full error below.

This fails on two different Ubuntu machines (both of which had proto 2.5 / pure-Python bindings installed before), but succeeds on two MacOS X machines (Mavericks and Yosemite; again both had 2.5 already).

Any help greatly appreciated!

Full error:

running build_ext
Traceback (most recent call last):
File "setup.py", line 200, in
"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 "build/bdist.linux-x86_64/egg/setuptools/command/test.py", line 142, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/test.py", line 122, in with_project_on_sys_path
File "/build/protobuf-2.6.1/python/google_apputils-0.4.1-py2.7.egg/google/apputils/setup_command.py", line 157, in run_tests
ok &= self._RunTestModule(file_path)
File "/build/protobuf-2.6.1/python/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/message_test.py", line 53, in
from google.protobuf import unittest_pb2
ImportError: cannot import name unittest_pb2

@markfickett
Copy link
Author

I had to delete the earlier protobuf installation:
$ sudo rm -r /usr/lib/python2.7/dist-packages/google
I'm not sure why that wasn't required on the macs, but it worked on both Ubuntu machines.

I also had to update ldconfig (I was getting "libprotobuf.so.9: cannot open shared object file: No such file").
$ sudo echo "/usr/local/lib" > /etc/ld.so.conf.d/local-libproto.conf
$ sudo ldconfig

For my sake this issue is closed. However, it may be an issue that on some platforms the system Python libraries are picked up before the local/build ones, by setup.py.

yordis pushed a commit to yordis/protobuf that referenced this issue Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant