Protocol buffers and CentOS

1,241 views
Skip to first unread message

Eric

unread,
Apr 6, 2010, 2:15:47 PM4/6/10
to Protocol Buffers
Hello,
I have installed python (2.6.5) and GPB on CentOS (it's a VM not
sure if that's relevant) but am not able to run. In it's simplest
version I do:
python -c "import google.protobuf"

and get:

Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named google.protobuf


I feel that either the gpb install did not work or I need to set an
env variable to point to some libraries.

thanks in advance,
Eric

Jason Hsueh

unread,
Apr 6, 2010, 6:22:28 PM4/6/10
to Eric, Protocol Buffers
How did you install the python protobuf library, and what was the output?


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.


Jason Hsueh

unread,
Apr 7, 2010, 2:51:45 PM4/7/10
to Sherry Yang, Protocol Buffers
(Adding the group back to the discussion)

pkg_resources should be part of setuptools, which should be installed as part of running the setup.py script. From the python README: 
2) If you do not have setuptools installed, note that it will be
   downloaded and installed automatically as soon as you run setup.py.
   If you would rather install it manually, you may do so by following
   the instructions on this page:


I'm not sure why this would have failed when doing the install - did you see any output related to setuptools?

On Wed, Apr 7, 2010 at 9:53 AM, Sherry Yang <yangc...@gmail.com> wrote:
Jason,
  Thanks - I did that and it helps and now I have a new error. Do you have any thoughts on this:

[jabber@jabberserver python]$ python -c "import google.protobuf"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "google/__init__.py", line 1, in <module>
    __import__('pkg_resources').declare_namespace(__name__)
ImportError: No module named pkg_resources


thanks again,
Eric


On Tue, Apr 6, 2010 at 4:40 PM, Jason Hsueh <jas...@google.com> wrote:
Eric -

Those commands install the C++ library - did you follow python/README.txt to install the python library?

Once you've done the below you should run:

python/ $ python setup.py test
python/ $ python setup.py install

(might need to sudo the last one)

That should install the modules into the correct locations so that you can import the protobuf library.

On Tue, Apr 6, 2010 at 4:27 PM, Sherry Yang <yangc...@gmail.com> wrote:
Hi Jason,
  Thanks for the followup. I did the standard:
./configure
make
make check
make install

and it seemed to run ok. I see a config.log file - is there anything I should look for there.

thanks again,
Eric

Sherry Yang

unread,
Apr 7, 2010, 4:30:49 PM4/7/10
to Jason Hsueh, Protocol Buffers
Jason,
  Thanks for the ideas. setuptools failed to install because zlib was not installed. I installed zlib and it still failed so I reinstalled python (after the zlib install) and everything works now.

thanks again!
Eric
Reply all
Reply to author
Forward
0 new messages