I am working with an Ubuntu 14.04 machine, trying to import the google.protobuf module into python 2.7.
I have tried
apt-get python-protobuf
and
pip install protobuf
without success.
Inside python, I get an error saying:
"ImportError: No module named google.protobuf"
Edit 1:
Sorry and thank you to everyone who commented. I'm still new to Ubuntu and StackOverflow.
Specifically, I type in to command line
python
import google.protobuf
and get the feedback
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named google.protobuf
I then type
exit()
I tried inputting
sudo apt-get install python-protobuf
which responds with
Reading package lists... Done Building dependency tree
Reading state information... Done python-protobuf is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 283 not upgraded.
Then I go back into python and try
import google.protobuf
again, but I get exactly the same error as before.
Finally, I tried
pip install protobuf
which responded with
Requirement already satisfied: protobuf in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: six>=1.9 in /usr/local/lib/python2.7/dist-packages (from protobuf)
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from protobuf)
I tried
python
import google.protobuf
and got exactly the same error. Putting
import protobuf
into python also gets the same error.
Some related information: I have tried doing multiple uninstalls/reinstalls with both apt-get and pip to fix th error, with no change. Also, one of the first things I did after getting Ubuntu was to download python 2.7 from the website and install it, not realizing python came with Ubuntu.
Thanks again.
How to Install protobuf on Windows? Type "cmd" in the search bar and hit Enter to open the command line. Type “ pip install protobuf ” (without quotes) in the command line and hit Enter again. This installs protobuf for your default Python installation.
protobuf. Empty states: A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method.
pip install --ignore-installed six
sudo pip install protobuf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With